Skip to content
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

Fix share type for public links #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/share_manager_owncloud/share_manager_owncloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func (sm *shareManager) getDBShare(ctx context.Context, accountID, id string) (*
permissions int
)

query := "SELECT coalesce(uid_owner, '') as uid_owner, coalesce(share_with, '') as share_with, coalesce(fileid_prefix, '') as fileid_prefix, coalesce(item_source, '') as item_source, stime, permissions, share_type FROM oc_share WHERE (share_type=2 OR item_type <> 'file') AND (orphan = 0 or orphan IS NULL) AND (uid_owner=? OR uid_initiator=?) and id=?"
query := "SELECT coalesce(uid_owner, '') as uid_owner, coalesce(share_with, '') as share_with, coalesce(fileid_prefix, '') as fileid_prefix, coalesce(item_source, '') as item_source, stime, permissions, share_type FROM oc_share WHERE (share_type=3 OR item_type <> 'file') AND (orphan = 0 or orphan IS NULL) AND (uid_owner=? OR uid_initiator=?) and id=?"
if err := sm.db.QueryRow(query, accountID, accountID, id).Scan(&uidOwner, &shareWith, &prefix, &itemSource, &stime, &permissions, &shareType); err != nil {
if err == sql.ErrNoRows {
return nil, api.NewError(api.FolderShareNotFoundErrorCode)
Expand All @@ -583,7 +583,7 @@ func (sm *shareManager) getDBShare(ctx context.Context, accountID, id string) (*
}

func (sm *shareManager) getDBShares(ctx context.Context, accountID, filterByFileID string) ([]*dbShare, error) {
query := "SELECT id, coalesce(uid_owner, '') as uid_owner, coalesce(share_with, '') as share_with, coalesce(fileid_prefix, '') as fileid_prefix, coalesce(item_source, '') as item_source, stime, permissions, share_type FROM oc_share WHERE (share_type=2 OR item_type <> 'file') AND (orphan = 0 OR orphan IS NULL) AND (uid_owner=? OR uid_initiator=?) AND (share_type=? OR share_type=?) "
query := "SELECT id, coalesce(uid_owner, '') as uid_owner, coalesce(share_with, '') as share_with, coalesce(fileid_prefix, '') as fileid_prefix, coalesce(item_source, '') as item_source, stime, permissions, share_type FROM oc_share WHERE item_type <> 'file' AND (orphan = 0 OR orphan IS NULL) AND (uid_owner=? OR uid_initiator=?) AND (share_type=? OR share_type=?) "
params := []interface{}{accountID, accountID, 0, 1}
if filterByFileID != "" {
prefix, itemSource := splitFileID(filterByFileID)
Expand Down
4 changes: 3 additions & 1 deletion revad/revad.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Name: revad
Summary: REVA is a gRPC backend server for CERNBox
Version: 0.0.54
Version: 0.0.55
Release: 1%{?dist}
License: AGPLv3
BuildRoot: %{_tmppath}/%{name}-buildroot
Expand Down Expand Up @@ -53,6 +53,8 @@ rm -rf %buildroot/
%config(noreplace) /etc/revad/revad.yaml

%changelog
* Tue Nov 09 2021 Ishank Arora <[email protected]> 0.0.55
- Fix share type for public links
* Tue Nov 09 2021 Ishank Arora <[email protected]> 0.0.54
- Filter file shares when listing shares created by user
* Wed Oct 27 2021 Ishank Arora <[email protected]> 0.0.53
Expand Down