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 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 { 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..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; @@ -252,8 +251,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) { @@ -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 @@ -517,8 +516,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 +532,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)