feat(core): Add S3 endpoint normalization, directory pagination, improved metadata checks, trash support, and related tests

This commit is contained in:
2025-11-20 13:58:02 +00:00
parent b8e5d9a222
commit 1f4b7319d3
6 changed files with 144 additions and 22 deletions

View File

@@ -4,11 +4,23 @@ import { File } from './classes.file.js';
export class MetaData {
public static async hasMetaData(optionsArg: { file: File }) {
// lets find the existing metadata file
const existingFile = await optionsArg.file.parentDirectoryRef.getFile({
path: optionsArg.file.name + '.metadata',
});
return !!existingFile;
// try finding the existing metadata file; return false if it doesn't exist
try {
const existingFile = await optionsArg.file.parentDirectoryRef.getFile({
path: optionsArg.file.name + '.metadata',
});
return !!existingFile;
} catch (error: any) {
const message = error?.message || '';
const isNotFound =
message.includes('File not found') ||
error?.name === 'NotFound' ||
error?.$metadata?.httpStatusCode === 404;
if (isNotFound) {
return false;
}
throw error;
}
}
// static