From 93d6180f0628ed6dc94270184b4e19477a05c337 Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Sat, 9 Sep 2023 02:44:54 +0800 Subject: [PATCH] Fix image path in detail pane for those inside NC albums --- app/lib/entity/file_descriptor.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/lib/entity/file_descriptor.dart b/app/lib/entity/file_descriptor.dart index efec4e06..d93a8513 100644 --- a/app/lib/entity/file_descriptor.dart +++ b/app/lib/entity/file_descriptor.dart @@ -1,6 +1,7 @@ import 'package:equatable/equatable.dart'; import 'package:nc_photos/entity/file.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; import 'package:path/path.dart' as path_lib; import 'package:to_string/to_string.dart'; @@ -77,7 +78,7 @@ extension FileDescriptorExtension on FileDescriptor { /// /// See: [strippedPathWithEmpty] String get strippedPath { - if (fdPath.contains("remote.php/dav/files")) { + if (fdPath.startsWith("remote.php/dav/files")) { final position = fdPath.indexOf("/", "remote.php/dav/files/".length) + 1; if (position == 0) { // root dir path @@ -85,6 +86,11 @@ extension FileDescriptorExtension on FileDescriptor { } else { return fdPath.substring(position); } + } else if (fdPath.startsWith("remote.php/dav/photos/")) { + // nextcloud albums + var position = fdPath.indexOf("/", "remote.php/dav/photos/".length) + 1; + position = fdPath.indexOf("/", position); + return fdPath.slice(position + 1); } else { return fdPath; }