From 9c8c69f99fef8894586d86af2f625b9a5ff23f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=85=B1=E5=A4=A9=E5=B0=8F=E7=A6=BD=E5=85=BD?= Date: Wed, 20 Jul 2022 00:00:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DWindows=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E4=BB=B6=E5=A4=B9=E5=91=BD=E5=90=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix bug with download path for Windows --- lib/src/service/gallery_download_service.dart | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/src/service/gallery_download_service.dart b/lib/src/service/gallery_download_service.dart index 5f1fe754..4f69ff13 100644 --- a/lib/src/service/gallery_download_service.dart +++ b/lib/src/service/gallery_download_service.dart @@ -547,10 +547,9 @@ class GalleryDownloadService extends GetxController { } String _computeGalleryDownloadPath(GalleryDownloadedData gallery) { - String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' '); - title = title.trim(); + String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' ').trim(); if (title.length > _maxTitleLength) { - title = title.substring(0, _maxTitleLength); + title = title.substring(0, _maxTitleLength).trim(); } return path.join( DownloadSetting.downloadPath.value, @@ -561,10 +560,9 @@ class GalleryDownloadService extends GetxController { String _computeImageDownloadRelativePath(GalleryDownloadedData gallery, int serialNo, {GalleryImage? image}) { image ??= gid2Images[gallery.gid]![serialNo]!; String ext = image.url.split('.').last; - String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' '); - title = title.trim(); + String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' ').trim(); if (title.length > _maxTitleLength) { - title = title.substring(0, _maxTitleLength); + title = title.substring(0, _maxTitleLength).trim(); } return path.relative( @@ -580,9 +578,9 @@ class GalleryDownloadService extends GetxController { String _computeImageDownloadAbsolutePath(GalleryDownloadedData gallery, int serialNo) { GalleryImage image = gid2Images[gallery.gid]![serialNo]!; String ext = image.url.split('.').last; - String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' '); + String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' ').trim(); if (title.length > _maxTitleLength) { - title = title.substring(0, _maxTitleLength); + title = title.substring(0, _maxTitleLength).trim(); } return path.join(