-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: cloudinary driver for goravel #4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR! A few questions.
Please add the |
cloudinary.go
Outdated
func (r *Cloudinary) getResourceType(path string) string { | ||
extension := strings.TrimPrefix(filepath.Ext(path), ".") | ||
value := "image" | ||
resourceTypes := r.config.Get(fmt.Sprintf("filesystems.disks.%s.resource_types", r.disk), defaultResourcesTypes()).(map[string][]string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov ReportPatch has no changes to coverable lines. π’ Thoughts on this report? Let us know!. |
ResourceType: r.getResourceType(path), | ||
}) | ||
// TODO: Search if there is a better way to get asset info | ||
assetTypes := []api.AssetType{api.Image, api.Video, api.File} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Why is there no api.Raw
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api.File
is actually api.Raw
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
They have defined it in this way:)
https://github.com/cloudinary/cloudinary-go/blob/main/api/api.go#L82
} | ||
|
||
// PutFileAs stores a new file on the disk. | ||
func (r *Cloudinary) PutFileAs(path string, source filesystem.File, name string) (string, error) { | ||
uploadResult, err := r.instance.Upload.Upload(r.ctx, source.File(), uploader.UploadParams{ | ||
Folder: validPath(path), | ||
PublicID: r.getPublicId(name), | ||
PublicID: name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Can the name contain extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are following cloudinary then u shouldn't but it won't give any error.
BUT URL OF FILE will contain two file extensions ie .../filename.png.png
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd better follow the cloudinary suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd better follow the cloudinary suggestion.
Yeah, we are following cloudinay(user's choice).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! I think we can go ahead after these two optimizations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #1
π Description
This PR will remove unnecessary folders and clean up code-base for review.
β Checks