Fixed encoding problems when downloading displaying/ downloading files with special characters

This commit is contained in:
Elias Müller 2023-09-17 09:56:15 +02:00
parent 2ed68c4fe7
commit a237fba482
2 changed files with 5 additions and 2 deletions

View File

@ -24,7 +24,7 @@ class CacheableFile {
CacheableFile.fromDavFile(WebDavFile file) {
path = file.path;
isDirectory = file.isDirectory;
name = file.name;
name = file.isDirectory ? file.name : file.path.split("/").last;
mimeType = file.mimeType;
size = file.size;
eTag = file.etag;

View File

@ -25,6 +25,9 @@ class FileElement extends StatefulWidget {
static Future<DownloaderCore> download(BuildContext context, String remotePath, String name, Function(double) onProgress, Function(OpenResult) onDone) async {
Directory paths = await getTemporaryDirectory();
var encodedPath = Uri.encodeComponent(remotePath);
encodedPath = encodedPath.replaceAll("%2F", "/");
String local = paths.path + Platform.pathSeparator + name;
DownloaderUtils options = DownloaderUtils(
@ -46,7 +49,7 @@ class FileElement extends StatefulWidget {
);
return await Flowder.download(
"${await WebdavApi.webdavConnectString}$remotePath",
"${await WebdavApi.webdavConnectString}$encodedPath",
options,
);
}