File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -654,7 +654,9 @@ void WebdavConnection::downloadPath( const QString &localPath )
654
654
655
655
void WebdavConnection::uploadPath ( const QString &localPath )
656
656
{
657
- QDir dir ( localPath );
657
+ QFileInfo fi ( QDir::cleanPath ( localPath ) );
658
+ QDir dir ( fi.isFile () ? fi.absolutePath () : fi.absoluteFilePath () );
659
+
658
660
bool webdavConfigurationExists = dir.exists ( " qfield_webdav_configuration.json" );
659
661
QStringList remoteChildrenPath;
660
662
while ( !webdavConfigurationExists )
@@ -683,20 +685,28 @@ void WebdavConnection::uploadPath( const QString &localPath )
683
685
{
684
686
mProcessRemotePath = mProcessRemotePath + remoteChildrenPath.join ( " /" ) + QStringLiteral ( " /" );
685
687
}
686
- mProcessLocalPath = QDir::cleanPath ( localPath ) + QDir::separator ();
688
+
689
+ mProcessLocalPath = QDir::cleanPath ( fi.isFile () ? fi.absolutePath () : fi.absoluteFilePath () ) + QDir::separator ();
687
690
688
691
mWebdavLastModified .clear ();
689
692
690
- mLocalItems .clear ();
691
- QDirIterator it ( mProcessLocalPath , QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories );
692
- while ( it.hasNext () )
693
+ if ( fi.isDir () )
693
694
{
694
- it.next ();
695
- if ( it.fileName () != QStringLiteral ( " qfield_webdav_configuration.json" ) )
695
+ mLocalItems .clear ();
696
+ QDirIterator it ( mProcessLocalPath , QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories );
697
+ while ( it.hasNext () )
696
698
{
697
- mLocalItems << it.fileInfo ();
699
+ it.next ();
700
+ if ( it.fileName () != QStringLiteral ( " qfield_webdav_configuration.json" ) )
701
+ {
702
+ mLocalItems << it.fileInfo ();
703
+ }
698
704
}
699
705
}
706
+ else
707
+ {
708
+ mLocalItems << fi;
709
+ }
700
710
701
711
mBytesProcessed = 0 ;
702
712
mBytesTotal = 0 ;
You can’t perform that action at this time.
0 commit comments