From 49adaadba6adc7454806a0750c97369033e954a5 Mon Sep 17 00:00:00 2001 From: xuyanwu <1171736840@qq.com> Date: Fri, 12 Jan 2024 13:13:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?Update:=E5=AE=8C=E5=96=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/dromara/x/file/storage/core/constant/Constant.java | 1 + 1 file changed, 1 insertion(+) diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/constant/Constant.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/constant/Constant.java index d5f795cc..d4b239b8 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/constant/Constant.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/constant/Constant.java @@ -101,6 +101,7 @@ interface AzureBlobStorageACL extends ACL {} *

εˆζ‹δΊ‘ USS {@link com.upyun.RestManager.PARAMS}

*

MinIO {@link io.minio.ObjectWriteArgs}

*

GoogleCloud Storage {@link com.google.cloud.storage.BlobInfo} {@link com.google.cloud.storage.Storage.BlobField}

+ *

FastDFS {@link org.dromara.x.file.storage.core.platform.FastDfsFileStorage#getObjectMetadata(org.dromara.x.file.storage.core.FileInfo)}

*

Azure Blob Storage {@link com.azure.storage.blob.models.BlobHttpHeaders}

*/ interface Metadata { From 98f4ae3d3bffe06ece55f6fd0e7d9a768a5bbcae Mon Sep 17 00:00:00 2001 From: xuyanwu <1171736840@qq.com> Date: Fri, 12 Jan 2024 17:41:22 +0800 Subject: [PATCH 2/4] =?UTF-8?q?Update:=E5=AE=8C=E5=96=84=20Azure=20Blob=20?= =?UTF-8?q?Storage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/platform/AzureBlobStorageFileStorage.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/AzureBlobStorageFileStorage.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/AzureBlobStorageFileStorage.java index 4814294c..bae27b97 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/AzureBlobStorageFileStorage.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/AzureBlobStorageFileStorage.java @@ -252,8 +252,8 @@ public void completeMultipartUpload(CompleteMultipartUploadPretreatment pre) { BlockBlobCommitBlockListOptions options = new BlockBlobCommitBlockListOptions(partList); options.setMetadata(fileInfo.getUserMetadata()); options.setHeaders(getBlobHttpHeaders(fileInfo.getContentType(), fileInfo.getMetadata())); - client.commitBlockListWithResponse(options, null, Context.NONE).getValue(); setFileAcl(newFileKey, acl); + client.commitBlockListWithResponse(options, null, Context.NONE).getValue(); if (fileInfo.getSize() == null) fileInfo.setSize(client.getProperties().getBlobSize()); } catch (Exception e) { @@ -517,8 +517,12 @@ public void sameCopy(FileInfo srcFileInfo, FileInfo destFileInfo, CopyPretreatme destFileInfo.setThUrl(getUrl(destThFileKey)); try { awaitCopy(destThClient.beginCopy(srcThClient.getBlobUrl(), Duration.ofSeconds(1))); - + setFileAcl(destThFileKey, getAcl(srcFileInfo.getThFileAcl())); } catch (Exception e) { + try { + destThClient.deleteIfExists(); + } catch (Exception ignored) { + } throw ExceptionFactory.sameCopyTh(srcFileInfo, destFileInfo, platform, e); } } @@ -529,6 +533,7 @@ public void sameCopy(FileInfo srcFileInfo, FileInfo destFileInfo, CopyPretreatme long size = srcClient.getProperties().getBlobSize(); ProgressListener.quickStart(pre.getProgressListener(), size); awaitCopy(destClient.beginCopy(srcClient.getBlobUrl(), Duration.ofSeconds(1))); + setFileAcl(destFileKey, getAcl(srcFileInfo.getFileAcl())); ProgressListener.quickFinish(pre.getProgressListener(), size); } catch (Exception e) { if (destThClient != null) From 94d09c440185332568e73625a0734a05f774d2de Mon Sep 17 00:00:00 2001 From: xuyanwu <1171736840@qq.com> Date: Fri, 12 Jan 2024 17:43:52 +0800 Subject: [PATCH 3/4] =?UTF-8?q?Update:=E4=BC=98=E5=8C=96=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- x-file-storage-core/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x-file-storage-core/pom.xml b/x-file-storage-core/pom.xml index 2a795b35..17acf3c6 100644 --- a/x-file-storage-core/pom.xml +++ b/x-file-storage-core/pom.xml @@ -157,6 +157,8 @@ cn.hutool hutool-extra + provided + true From c5c1883e505442dc2fdcd42ed85c38b6f4dd9206 Mon Sep 17 00:00:00 2001 From: xuyanwu <1171736840@qq.com> Date: Fri, 12 Jan 2024 17:45:58 +0800 Subject: [PATCH 4/4] =?UTF-8?q?Update:=E5=AE=8C=E5=96=84=20Azure=20Blob=20?= =?UTF-8?q?Storage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/platform/AzureBlobStorageFileStorage.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/AzureBlobStorageFileStorage.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/AzureBlobStorageFileStorage.java index bae27b97..d68340f1 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/AzureBlobStorageFileStorage.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/AzureBlobStorageFileStorage.java @@ -19,7 +19,6 @@ import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; import com.azure.storage.blob.specialized.BlockBlobClient; import com.azure.storage.file.datalake.*; -import com.azure.storage.file.datalake.models.PathAccessControl; import com.azure.storage.file.datalake.models.PathAccessControlEntry; import com.azure.storage.file.datalake.models.PathPermissions; import com.azure.storage.file.datalake.models.RolePermissions; @@ -346,9 +345,9 @@ public void setFileAcl(String fileKey, AclWrapper acl) { if (acl == null) return; if (StrUtil.isBlank(fileKey)) return; DataLakeFileClient fileClient = getDataLakeFileClient(fileKey); - PathAccessControl fileAccessControl = fileClient.getAccessControl(); - List pathPermissions = fileAccessControl.getAccessControlList(); - System.out.println(PathAccessControlEntry.serializeList(pathPermissions)); + // PathAccessControl fileAccessControl = fileClient.getAccessControl(); + // List pathPermissions = fileAccessControl.getAccessControlList(); + // System.out.println(PathAccessControlEntry.serializeList(pathPermissions)); if (acl.getPermissions() != null) { fileClient.setPermissions(acl.getPermissions(), null, null); } else if (acl.getAclList() != null) { @@ -356,8 +355,8 @@ public void setFileAcl(String fileKey, AclWrapper acl) { } else { throw new NullPointerException(); } - pathPermissions = fileClient.getAccessControl().getAccessControlList(); - System.out.println(PathAccessControlEntry.serializeList(pathPermissions)); + // pathPermissions = fileClient.getAccessControl().getAccessControlList(); + // System.out.println(PathAccessControlEntry.serializeList(pathPermissions)); } @Override