-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Implement CreateLink and setup linker test in go-service-oss #48
Conversation
storage.go
Outdated
o = s.newObject(true) | ||
o.ID = rp | ||
o.Path = path | ||
o.SetLinkTarget("/" + rt) |
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 add /
here?
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.
Because when I tested it, I found that each time the target was missing a /
compared to the expect target.
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.
Because when I tested it, I found that each time the target was missing a
/
compared to the expect target.
It's not the root cause.
Object storage services like oss, s3 will not have absolute paths like fs. So we need to convert between internal object key and paths that exposed to users.
o.Mode |= ModeLink | ||
|
||
// oss `symlink` supports `overwrite`, so we don't need to check if path exists. | ||
err = s.bucket.PutSymlink(rp, rt) |
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.
We need to call API first.
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.
Got it!
storage.go
Outdated
o = s.newObject(true) | ||
o.ID = rp | ||
o.Path = path | ||
o.SetLinkTarget("/" + rt) |
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.
Because when I tested it, I found that each time the target was missing a
/
compared to the expect target.
It's not the root cause.
Object storage services like oss, s3 will not have absolute paths like fs. So we need to convert between internal object key and paths that exposed to users.
Do we need to check whether the object is symlink in |
I think both are fine. If we need to check if the objects in the |
I think there's no need to add We can get the object type form the response of |
feat: Implement CreateLink and setup linker test in go-service-oss