fix(core): update
This commit is contained in:
@ -44,7 +44,7 @@ export class Directory {
|
||||
let basePath = '';
|
||||
for (const parentDir of parentDirectories) {
|
||||
if (parentDir.name === '') {
|
||||
basePath = this.name;
|
||||
basePath = this.name + '/';
|
||||
continue;
|
||||
}
|
||||
basePath = parentDir.name + '/' + this.name;
|
||||
@ -57,13 +57,17 @@ export class Directory {
|
||||
*/
|
||||
public async listFiles(): Promise<File[]> {
|
||||
const done = plugins.smartpromise.defer();
|
||||
const fileNameStream = await this.bucketRef.smartbucketRef.minioClient.listObjects(
|
||||
const fileNameStream = await this.bucketRef.smartbucketRef.minioClient.listObjectsV2(
|
||||
this.bucketRef.name,
|
||||
this.getBasePath()
|
||||
this.getBasePath(),
|
||||
false
|
||||
);
|
||||
const fileArray: File[] = [];
|
||||
const duplexStream = plugins.streamfunction.createDuplexStream<plugins.minio.BucketItem, void>(
|
||||
async bucketItem => {
|
||||
if (bucketItem.prefix) {
|
||||
return;
|
||||
}
|
||||
if (!bucketItem.name) {
|
||||
return;
|
||||
}
|
||||
@ -89,15 +93,19 @@ export class Directory {
|
||||
*/
|
||||
public async listDirectories(): Promise<Directory[]> {
|
||||
const done = plugins.smartpromise.defer();
|
||||
const completeDirStream = await this.bucketRef.smartbucketRef.minioClient.listObjects(
|
||||
const basePath = this.getBasePath();
|
||||
const completeDirStream = await this.bucketRef.smartbucketRef.minioClient.listObjectsV2(
|
||||
this.bucketRef.name,
|
||||
this.getBasePath(),
|
||||
true
|
||||
false
|
||||
);
|
||||
const directoryArray: Directory[] = [];
|
||||
const duplexStream = plugins.streamfunction.createDuplexStream<plugins.minio.BucketItem, void>(
|
||||
async bucketItem => {
|
||||
let subtractedPath = bucketItem.name.replace(this.getBasePath(), '');
|
||||
if (bucketItem.name) {
|
||||
return;
|
||||
}
|
||||
let subtractedPath = bucketItem.prefix.replace(this.getBasePath(), '');
|
||||
if (subtractedPath.startsWith('/')) {
|
||||
subtractedPath = subtractedPath.substr(1);
|
||||
}
|
||||
@ -122,7 +130,7 @@ export class Directory {
|
||||
* gets an array that has all objects with a certain prefix;
|
||||
*/
|
||||
public async getTreeArray() {
|
||||
const treeArray = await this.bucketRef.smartbucketRef.minioClient.listObjects(
|
||||
const treeArray = await this.bucketRef.smartbucketRef.minioClient.listObjectsV2(
|
||||
this.bucketRef.name,
|
||||
this.getBasePath(),
|
||||
true
|
||||
|
Reference in New Issue
Block a user