From 6fd9ad7bc454a1f128b99e316cdf28d6086f49be Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Sun, 5 Sep 2021 19:13:07 +0800 Subject: [PATCH] Fix username in NC is case-insensitive --- lib/bloc/list_album.dart | 2 +- lib/entity/file.dart | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/bloc/list_album.dart b/lib/bloc/list_album.dart index ac3bc007..92da76c5 100644 --- a/lib/bloc/list_album.dart +++ b/lib/bloc/list_album.dart @@ -261,7 +261,7 @@ class ListAlbumBloc extends Bloc { final items = albums.map((e) { final isSharedByMe = shares.any((element) => element.path.trimAny("/") == e.albumFile!.strippedPath); - final isSharedToMe = e.albumFile!.ownerId != ev.account.username; + final isSharedToMe = !e.albumFile!.isOwned(ev.account.username); return ListAlbumBlocItem(e, isSharedByMe, isSharedToMe); }).toList(); diff --git a/lib/entity/file.dart b/lib/entity/file.dart index f8b96891..3e7167d4 100644 --- a/lib/entity/file.dart +++ b/lib/entity/file.dart @@ -461,7 +461,8 @@ extension FileExtension on File { } } - bool isOwned(String username) => ownerId == null || ownerId == username; + bool isOwned(String username) => + ownerId == null || ownerId?.toLowerCase() == username.toLowerCase(); static final _log = Logger("entity.file.FileExtension"); }