diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index c4824fbc61f..f2d835f8c42 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -645,11 +645,16 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) { // if we are in a jail and the current share has been accepted use the stat from the share jail // Needed because received shares can be jailed in a folder in the users home - // if we have share jail infos use them to build the path - if sji := findMatch(shareJailInfos, rs.Share.ResourceId); sji != nil { - // override path with info from share jail - data.FileTarget = path.Join(h.sharePrefix, path.Base(sji.Path)) - data.Path = path.Join(h.sharePrefix, path.Base(sji.Path)) + if h.sharePrefix != "/" { + // if we have share jail infos use them to build the path + if sji := findMatch(shareJailInfos, rs.Share.ResourceId); sji != nil { + // override path with info from share jail + data.FileTarget = path.Join(h.sharePrefix, path.Base(sji.Path)) + data.Path = path.Join(h.sharePrefix, path.Base(sji.Path)) + } else { + data.FileTarget = path.Join(h.sharePrefix, path.Base(info.Path)) + data.Path = path.Join(h.sharePrefix, path.Base(info.Path)) + } } else { data.FileTarget = info.Path data.Path = info.Path @@ -794,8 +799,13 @@ func (h *Handler) addFileInfo(ctx context.Context, s *conversions.ShareData, inf s.ItemSource = wrapResourceID(info.Id) s.FileSource = s.ItemSource s.StorageID = storageIDPrefix + s.FileTarget - s.FileTarget = path.Join("/", info.Path) - s.Path = path.Join("/", info.Path) + if h.sharePrefix != "/" { + s.FileTarget = path.Join("/", path.Base(info.Path)) + s.Path = path.Join("/", path.Base(info.Path)) + } else { + s.FileTarget = path.Join("/", info.Path) + s.Path = path.Join("/", info.Path) + } // TODO FileParent: // item type s.ItemType = conversions.ResourceType(info.GetType()).String()