Skip to content

Commit

Permalink
update upload-from-url role resource
Browse files Browse the repository at this point in the history
  • Loading branch information
LIlGG committed Aug 21, 2024
1 parent 9526cb4 commit eddbf10
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public Mono<URI> getSharedURL(Attachment attachment, Duration ttl) {
@Override
public Mono<Attachment> uploadFromUrl(@NonNull URL url, @NonNull String policyName,
String groupName, String filename) {
// TODO validate url
var uri = URI.create(url.toString());
AtomicReference<MediaType> mediaTypeRef = new AtomicReference<>();
AtomicReference<String> fileNameRef = new AtomicReference<>(filename);
Expand Down Expand Up @@ -176,9 +175,7 @@ private static String getExternalUrlFilename(URI externalUrl, HttpHeaders httpHe
var path = externalUrl.getPath();
fileName = Paths.get(path).getFileName().toString();
}
if (!FileNameUtils.hasFileExtension(fileName)) {
// TODO get file extension from media type
}
// TODO get file extension from media type
return fileName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ rules:
- apiGroups: [ "api.console.halo.run" ]
resources: [ "attachments" ]
verbs: [ "*" ]
- apiGroups: [ "api.console.halo.run" ]
resources: [ "attachments/upload-from-url" ]
verbs: [ "create" ]
- apiGroups: [ "" ]
resources: [ "settings" ]
verbs: [ "get" ]
- nonResourceURLs: [
"/apis/api.console.halo.run/v1alpha1/attachments/upload",
"/apis/api.console.halo.run/v1alpha1/attachments/-/upload-from-url"
"/apis/api.console.halo.run/v1alpha1/attachments/upload"
]
verbs: [ "create" ]
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ rules:
- apiGroups: [ "uc.api.content.halo.run" ]
resources: [ "attachments" ]
verbs: [ "create", "update", "delete" ]
- nonResourceURLs: [
"/apis/api.console.halo.run/v1alpha1/attachments/-/upload-from-url"
]
- apiGroups: [ "uc.api.content.halo.run" ]
resources: [ "attachments/upload-from-url" ]
verbs: [ "create" ]

0 comments on commit eddbf10

Please sign in to comment.