@genoacms/adapter-gcp 0.7.1-fix.4 → 0.7.1-fix.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
|
|
1
1
|
import { getBucket } from './storage.js';
|
2
|
-
import { join } from 'path';
|
3
2
|
const getObject = async ({ bucket, name }) => {
|
4
3
|
const bucketInstance = getBucket(bucket);
|
5
4
|
const file = bucketInstance.file(name);
|
@@ -35,7 +34,7 @@ const listDirectory = async ({ bucket, name }, listingParams = {}) => {
|
|
35
34
|
const bucketInstance = getBucket(bucket);
|
36
35
|
const options = {
|
37
36
|
autoPaginate: false,
|
38
|
-
prefix:
|
37
|
+
prefix: name,
|
39
38
|
maxResults: listingParams?.limit,
|
40
39
|
startOffset: listingParams?.startAfter,
|
41
40
|
delimiter: '/'
|
@@ -51,7 +50,7 @@ const listDirectory = async ({ bucket, name }, listingParams = {}) => {
|
|
51
50
|
lastModified: new Date(file.metadata.updated)
|
52
51
|
};
|
53
52
|
}),
|
54
|
-
directories: (apiResponse?.prefixes ?? []).filter((item) => item !== name)
|
53
|
+
directories: (apiResponse?.prefixes ?? []).filter((item) => item !== name).map(i => i.replace(name, ''))
|
55
54
|
};
|
56
55
|
};
|
57
56
|
const createDirectory = async ({ bucket, name }) => {
|
package/package.json
CHANGED
@@ -4,7 +4,6 @@ import type {
|
|
4
4
|
} from '@genoacms/cloudabstraction/storage'
|
5
5
|
import { type File } from '@google-cloud/storage'
|
6
6
|
import { getBucket } from './storage.js'
|
7
|
-
import { join } from 'path'
|
8
7
|
|
9
8
|
const getObject: Adapter['getObject'] = async ({ bucket, name }) => {
|
10
9
|
const bucketInstance = getBucket(bucket)
|
@@ -47,7 +46,7 @@ const listDirectory: Adapter['listDirectory'] = async ({ bucket, name }, listing
|
|
47
46
|
const bucketInstance = getBucket(bucket)
|
48
47
|
const options = {
|
49
48
|
autoPaginate: false,
|
50
|
-
prefix:
|
49
|
+
prefix: name,
|
51
50
|
maxResults: listingParams?.limit,
|
52
51
|
startOffset: listingParams?.startAfter,
|
53
52
|
delimiter: '/'
|
@@ -66,7 +65,7 @@ const listDirectory: Adapter['listDirectory'] = async ({ bucket, name }, listing
|
|
66
65
|
lastModified: new Date(file.metadata.updated as string)
|
67
66
|
} satisfies StorageObject
|
68
67
|
}),
|
69
|
-
directories: (apiResponse?.prefixes ?? []).filter((item) => item !== name)
|
68
|
+
directories: (apiResponse?.prefixes ?? []).filter((item) => item !== name).map(i => i.replace(name, ''))
|
70
69
|
}
|
71
70
|
}
|
72
71
|
|