mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-24 02:18:50 +01:00
Workaround server bug where REPORT api no longer respect the path
This commit is contained in:
parent
d1d77ab2d2
commit
63c601f59a
6 changed files with 7 additions and 5 deletions
|
@ -18,7 +18,7 @@ class FindFile {
|
|||
/// [onFileNotFound] is null, a [StateError] will be thrown
|
||||
Future<List<File>> call(
|
||||
Account account,
|
||||
List<int> fileIds, {
|
||||
Iterable<int> fileIds, {
|
||||
void Function(int fileId)? onFileNotFound,
|
||||
}) async {
|
||||
_log.info("[call] fileIds: ${fileIds.toReadableString()}");
|
||||
|
|
|
@ -24,9 +24,10 @@ class ListTaggedFile {
|
|||
taggedFiles.addAll(await _c.taggedFileRepo
|
||||
.list(account, File(path: file_util.unstripPath(account, r)), tags));
|
||||
}
|
||||
// server bug workaround, filter out repeated files
|
||||
final files = await FindFile(_c)(
|
||||
account,
|
||||
taggedFiles.map((f) => f.fileId).toList(),
|
||||
taggedFiles.map((f) => f.fileId).toSet(),
|
||||
onFileNotFound: (id) {
|
||||
// ignore missing file
|
||||
_log.warning("[call] Missing file: $id");
|
||||
|
|
|
@ -293,6 +293,7 @@ class ApiFiles {
|
|||
}
|
||||
}
|
||||
|
||||
// SERVER_BUG: 26 to unknown. path is ignored by server
|
||||
Future<Response> report({
|
||||
required String path,
|
||||
bool? favorite,
|
||||
|
|
|
@ -293,7 +293,7 @@ abstract class NpDb {
|
|||
/// Returned files are NOT guaranteed to be sorted as [fileIds]
|
||||
Future<List<DbFile>> getFilesByFileIds({
|
||||
required DbAccount account,
|
||||
required List<int> fileIds,
|
||||
required Iterable<int> fileIds,
|
||||
});
|
||||
|
||||
/// Return [DbFile]s by their date time value
|
||||
|
|
|
@ -111,7 +111,7 @@ extension SqliteDbFileExtension on SqliteDb {
|
|||
/// Returned files are NOT guaranteed to be sorted as [fileIds]
|
||||
Future<List<CompleteFile>> queryFilesByFileIds({
|
||||
required ByAccount account,
|
||||
required List<int> fileIds,
|
||||
required Iterable<int> fileIds,
|
||||
}) {
|
||||
_log.info("[queryFilesByFileIds] fileIds: ${fileIds.toReadableString()}");
|
||||
return fileIds.withPartition((sublist) {
|
||||
|
|
|
@ -236,7 +236,7 @@ class NpDbSqlite implements NpDb {
|
|||
@override
|
||||
Future<List<DbFile>> getFilesByFileIds({
|
||||
required DbAccount account,
|
||||
required List<int> fileIds,
|
||||
required Iterable<int> fileIds,
|
||||
}) async {
|
||||
final sqlObjs = await _db.use((db) async {
|
||||
return await db.queryFilesByFileIds(
|
||||
|
|
Loading…
Reference in a new issue