mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-07 02:20:28 +08:00
feat: standardize Resource APIs by handling path prefix internally and returning clean paths (#4047)
This commit is contained in:
@@ -31,9 +31,11 @@ func GetDirectResources(owner string, user string, provider *Provider, prefix st
|
||||
fullPathPrefix := util.UrlJoin(provider.PathPrefix, prefix)
|
||||
objects, err := storageProvider.List(fullPathPrefix)
|
||||
for _, obj := range objects {
|
||||
name := strings.TrimPrefix(obj.Path, "/")
|
||||
name = strings.TrimPrefix(name, provider.PathPrefix+"/")
|
||||
resource := &Resource{
|
||||
Owner: owner,
|
||||
Name: strings.TrimPrefix(obj.Path, "/"),
|
||||
Name: name,
|
||||
CreatedTime: obj.LastModified.Local().Format(time.RFC3339),
|
||||
User: user,
|
||||
Provider: "",
|
||||
|
Reference in New Issue
Block a user