Merge pull request #4004 from owncloud/fix_hidden_detection

Fix hidden detection
This commit is contained in:
Klaas Freitag 2015-10-28 09:28:35 +01:00
commit 0c9568f6dc
3 changed files with 62 additions and 43 deletions

View file

@ -683,8 +683,8 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
}
/* skip "." and ".." */
if (d_name[0] == '.' && (d_name[1] == '\0'
|| (d_name[1] == '.' && d_name[2] == '\0'))) {
if ( (d_name[0] == '.' && d_name[1] == '\0')
|| (d_name[0] == '.' && d_name[1] == '.' && d_name[2] == '\0')) {
csync_vio_file_stat_destroy(dirent);
dirent = NULL;
continue;
@ -741,6 +741,16 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
res = 0;
}
/* for non windows platforms, detect if the filename starts with a .
* and if so, it's a hidden file. For windows, the hidden state is
* discovered within the vio local stat function.
*/
#ifndef _WIN32
if( d_name[0] == '.' ) {
fs->flags |= CSYNC_VIO_FILE_FLAGS_HIDDEN;
}
#endif
if( res == 0) {
switch (dirent->type) {
case CSYNC_VIO_FILE_TYPE_SYMBOLIC_LINK:

View file

@ -317,7 +317,13 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file,QMap
if (!file_stat->etag || strlen(file_stat->etag) == 0) {
qDebug() << "WARNING: etag of" << file_stat->name << "is" << file_stat->etag << " This must not happen.";
}
if( file.startsWith(QChar('.')) ) {
QStringRef fileRef(&file);
int slashPos = file.lastIndexOf(QLatin1Char('/'));
if( slashPos > -1 ) {
fileRef = fileRef.mid(slashPos+1);
}
if( fileRef.startsWith(QChar('.')) ) {
file_stat->flags = CSYNC_VIO_FILE_FLAGS_HIDDEN;
}
//qDebug() << "!!!!" << file_stat << file_stat->name << file_stat->file_id << map.count();

View file

@ -4,7 +4,7 @@
<message>
<location filename="../src/libsync/filesystem.cpp" line="227"/>
<source>The destination file has an unexpected size or modification time</source>
<translation type="unfinished"/>
<translation></translation>
</message>
</context>
<context>
@ -17,7 +17,7 @@
<message>
<location filename="../src/gui/folderwizardsourcepage.ui" line="33"/>
<source>Pick a local folder on your computer to sync</source>
<translation></translation>
<translation></translation>
</message>
<message>
<location filename="../src/gui/folderwizardsourcepage.ui" line="44"/>
@ -73,22 +73,22 @@
<message>
<location filename="../src/gui/accountsettings.ui" line="73"/>
<source>Remove the account configuration from the client</source>
<translation type="unfinished"/>
<translation></translation>
</message>
<message>
<location filename="../src/gui/accountsettings.ui" line="76"/>
<source>Remove Account</source>
<translation type="unfinished"/>
<translation></translation>
</message>
<message>
<location filename="../src/gui/accountsettings.ui" line="97"/>
<source>Storage space: ...</source>
<translation type="unfinished"/>
<translation>儲存空間容量: ...</translation>
</message>
<message>
<location filename="../src/gui/accountsettings.ui" line="167"/>
<source>Unchecked folders will be &lt;b&gt;removed&lt;/b&gt; from your local file system and will not be synchronized to this computer anymore</source>
<translation type="unfinished"/>
<translation> &lt;b&gt;&lt;/b&gt; </translation>
</message>
<message>
<location filename="../src/gui/accountsettings.ui" line="211"/>
@ -120,7 +120,7 @@
<message>
<location filename="../src/gui/accountsettings.cpp" line="230"/>
<source>&lt;p&gt;Could not create local folder &lt;i&gt;%1&lt;/i&gt;.</source>
<translation type="unfinished"/>
<translation>&lt;p&gt; &lt;i&gt;%1&lt;/i&gt;</translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="283"/>
@ -135,7 +135,7 @@
<message>
<location filename="../src/gui/accountsettings.cpp" line="310"/>
<source>&lt;p&gt;Do you really want to reset folder &lt;i&gt;%1&lt;/i&gt; and rebuild your client database?&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; This function is designed for maintenance purposes only. No files will be removed, but this can cause significant data traffic and take several minutes or hours to complete, depending on the size of the folder. Only use this option if advised by your administrator.&lt;/p&gt;</source>
<translation type="unfinished"/>
<translation>&lt;p&gt; &lt;i&gt;%1&lt;/i&gt; ?&lt;/p&gt;&lt;p&gt;&lt;b&gt;:&lt;/b&gt; 使使&lt;/p&gt;</translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="391"/>
@ -165,17 +165,17 @@
<message>
<location filename="../src/gui/accountsettings.cpp" line="480"/>
<source>Signed out from %1.</source>
<translation type="unfinished"/>
<translation> %1 </translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="482"/>
<source>No connection to %1 at %2.</source>
<translation type="unfinished"/>
<translation> %2 %1</translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="535"/>
<source>There are new folders that were not synchronized because they are too big: %1</source>
<translation type="unfinished"/>
<translation>: %1</translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="536"/>
@ -185,12 +185,12 @@
<message>
<location filename="../src/gui/accountsettings.cpp" line="563"/>
<source>Confirm Account Removal</source>
<translation type="unfinished"/>
<translation></translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="564"/>
<source>&lt;p&gt;Do you really want to remove the connection to the account &lt;i&gt;%1&lt;/i&gt;?&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; This will &lt;b&gt;not&lt;/b&gt; delete any files.&lt;/p&gt;</source>
<translation type="unfinished"/>
<translation>&lt;p&gt; &lt;i&gt;%1&lt;/i&gt; ?&lt;/p&gt;&lt;p&gt;&lt;b&gt;:&lt;/b&gt; &lt;b&gt;&lt;/b&gt; &lt;/p&gt;</translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="570"/>
@ -220,32 +220,32 @@
<message>
<location filename="../src/gui/accountsettings.cpp" line="176"/>
<source>Remove sync</source>
<translation type="unfinished"/>
<translation></translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="277"/>
<source>Confirm Sync Removal</source>
<translation type="unfinished"/>
<translation></translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="278"/>
<source>&lt;p&gt;Do you really want to stop syncing the folder &lt;i&gt;%1&lt;/i&gt;?&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; This will &lt;b&gt;not&lt;/b&gt; delete any files.&lt;/p&gt;</source>
<translation type="unfinished"/>
<translation>&lt;p&gt; &lt;i&gt;%1&lt;/i&gt;?&lt;/p&gt;&lt;p&gt;&lt;b&gt;:&lt;/b&gt; &lt;b&gt;&lt;/b&gt; &lt;/p&gt;</translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="447"/>
<source>%1 (%3%) of %2 in use. Some folders, including network mounted or shared folders, might have different limits.</source>
<translation type="unfinished"/>
<translation>%1 (%3%) %2 使 </translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="448"/>
<source>%1 of %2 in use</source>
<translation type="unfinished"/>
<translation>使 %2 %1%</translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="453"/>
<source>Currently there is no storage usage information available.</source>
<translation type="unfinished"/>
<translation>使</translation>
</message>
<message>
<location filename="../src/gui/accountsettings.cpp" line="488"/>
@ -263,7 +263,7 @@
<message>
<location filename="../src/gui/accountstate.cpp" line="97"/>
<source>Disconnected</source>
<translation type="unfinished"/>
<translation></translation>
</message>
<message>
<location filename="../src/gui/accountstate.cpp" line="99"/>
@ -273,12 +273,12 @@
<message>
<location filename="../src/gui/accountstate.cpp" line="101"/>
<source>Service unavailable</source>
<translation type="unfinished"/>
<translation>使</translation>
</message>
<message>
<location filename="../src/gui/accountstate.cpp" line="103"/>
<source>Network error</source>
<translation type="unfinished"/>
<translation></translation>
</message>
<message>
<location filename="../src/gui/accountstate.cpp" line="105"/>
@ -288,7 +288,7 @@
<message>
<location filename="../src/gui/accountstate.cpp" line="107"/>
<source>Unknown account state</source>
<translation type="unfinished"/>
<translation></translation>
</message>
</context>
<context>
@ -301,7 +301,7 @@
<message>
<location filename="../src/gui/addcertificatedialog.ui" line="23"/>
<source>This server probably requires a SSL client certificate.</source>
<translation type="unfinished"/>
<translation>SSL的客戶端憑證</translation>
</message>
<message>
<location filename="../src/gui/addcertificatedialog.ui" line="35"/>
@ -367,7 +367,7 @@
<message>
<location filename="../src/libsync/connectionvalidator.cpp" line="118"/>
<source>Please update to the latest server and restart the client.</source>
<translation type="unfinished"/>
<translation></translation>
</message>
<message>
<location filename="../src/libsync/connectionvalidator.cpp" line="143"/>
@ -382,7 +382,7 @@
<message>
<location filename="../src/libsync/connectionvalidator.cpp" line="186"/>
<source>The provided credentials are not correct</source>
<translation type="unfinished"/>
<translation></translation>
</message>
</context>
<context>
@ -406,7 +406,7 @@
<message>
<location filename="../src/gui/folder.cpp" line="107"/>
<source>Unable to create csync-context</source>
<translation type="unfinished"/>
<translation>csync-context</translation>
</message>
<message>
<location filename="../src/gui/folder.cpp" line="161"/>
@ -416,7 +416,7 @@
<message>
<location filename="../src/gui/folder.cpp" line="164"/>
<source>%1 should be a folder but is not.</source>
<translation type="unfinished"/>
<translation>, %1 </translation>
</message>
<message>
<location filename="../src/gui/folder.cpp" line="167"/>
@ -432,7 +432,7 @@
<location filename="../src/gui/folder.cpp" line="508"/>
<source>%1 and %2 other files have been removed.</source>
<comment>%1 names a file.</comment>
<translation type="unfinished"/>
<translation>%1 %2 </translation>
</message>
<message>
<location filename="../src/gui/folder.cpp" line="510"/>
@ -466,7 +466,7 @@
<message>
<location filename="../src/gui/folder.cpp" line="529"/>
<source>%1 has been renamed to %2 and %3 other files have been renamed.</source>
<translation type="unfinished"/>
<translation>%1 %2 %3 </translation>
</message>
<message>
<location filename="../src/gui/folder.cpp" line="531"/>
@ -477,7 +477,7 @@
<message>
<location filename="../src/gui/folder.cpp" line="536"/>
<source>%1 has been moved to %2 and %3 other files have been moved.</source>
<translation type="unfinished"/>
<translation>%1 %2 %3 </translation>
</message>
<message>
<location filename="../src/gui/folder.cpp" line="538"/>
@ -488,12 +488,12 @@
<location filename="../src/gui/folder.cpp" line="543"/>
<source>%1 and %2 other files could not be synced due to errors. See the log for details.</source>
<comment>%1 names a file.</comment>
<translation type="unfinished"/>
<translation>%1 %2 </translation>
</message>
<message>
<location filename="../src/gui/folder.cpp" line="545"/>
<source>%1 could not be synced due to an error. See the log for details.</source>
<translation type="unfinished"/>
<translation>%1 </translation>
</message>
<message>
<location filename="../src/gui/folder.cpp" line="553"/>
@ -509,14 +509,17 @@
<location filename="../src/gui/folder.cpp" line="1102"/>
<source>A new folder larger than %1 MB has been added: %2.
Please go in the settings to select it if you wish to download it.</source>
<translation type="unfinished"/>
<translation> %1 MB : %2.
</translation>
</message>
<message>
<location filename="../src/gui/folder.cpp" line="1115"/>
<source>This sync would remove all the files in the sync folder '%1'.
This might be because the folder was silently reconfigured, or that all the files were manually removed.
Are you sure you want to perform this operation?</source>
<translation type="unfinished"/>
<translation> &apos;%1&apos;
?</translation>
</message>
<message>
<location filename="../src/gui/folder.cpp" line="1119"/>
@ -554,7 +557,7 @@ Are you sure you want to perform this operation?</source>
<message>
<location filename="../src/gui/folderman.cpp" line="882"/>
<source> (backup %1)</source>
<translation type="unfinished"/>
<translation>( %1)</translation>
</message>
<message>
<location filename="../src/gui/folderman.cpp" line="1091"/>
@ -584,7 +587,7 @@ Are you sure you want to perform this operation?</source>
<message>
<location filename="../src/gui/folderman.cpp" line="1108"/>
<source>Last Sync was successful, but with warnings on individual files.</source>
<translation type="unfinished"/>
<translation></translation>
</message>
<message>
<location filename="../src/gui/folderman.cpp" line="1111"/>
@ -609,12 +612,12 @@ Are you sure you want to perform this operation?</source>
<message>
<location filename="../src/gui/folderman.cpp" line="1131"/>
<source>No valid folder selected!</source>
<translation type="unfinished"/>
<translation></translation>
</message>
<message>
<location filename="../src/gui/folderman.cpp" line="1142"/>
<source>The selected path is not a folder!</source>
<translation type="unfinished"/>
<translation>!</translation>
</message>
<message>
<location filename="../src/gui/folderman.cpp" line="1146"/>
@ -2008,7 +2011,7 @@ It is not advisable to use it.</source>
<message>
<location filename="../src/gui/selectivesyncdialog.cpp" line="381"/>
<source>Unchecked folders will be &lt;b&gt;removed&lt;/b&gt; from your local file system and will not be synchronized to this computer anymore</source>
<translation type="unfinished"/>
<translation> &lt;b&gt;&lt;/b&gt; </translation>
</message>
<message>
<location filename="../src/gui/selectivesyncdialog.cpp" line="395"/>