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

Manage the Nextcloud trash #4432

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Manage the Nextcloud trash #4432

wants to merge 5 commits into from

Conversation

nono
Copy link
Member

@nono nono commented Jun 27, 2024

No description provided.

nono added 5 commits June 27, 2024 09:13
The path for files/directories inside the NextCloud trashbin are NOT
their parent path + their name, but also contains a suffix. So, we need
to add the path to the response to allow the clients to make operations
on them.
@nono nono requested a review from cballevre June 27, 2024 10:33
@nono nono requested a review from a team as a code owner June 27, 2024 10:33
"attributes": {
"type": "directory",
"name": "Old",
"path": "/trash/Old.d93571568",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cballevre be careful, the path for things inside the trash is a bit weird and cannot be computed with just the parent and the name, so it was added to the response

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting clarification. I saw that you added the path everywhere. In cozy-client, I add a second attribute named parentPath. It corresponds to the folder path. This is to make it easier to replay requests with sift.js (commit with some explanation). Wouldn't it make sense to add it to the back as well, so we wouldn't have to calculate anything on the front?

model/nextcloud/nextcloud.go Show resolved Hide resolved
}

func (nc *NextCloud) Upload(path, mime string, contentLength int64, body io.Reader) error {
headers := map[string]string{
echo.HeaderContentType: mime,
}
path = "/files/" + nc.userID + "/" + path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it could be the right time to add a filePath(path string) and a trashedPath(path string) methods?!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For filePath, I'm not convinced, but why not. For trashedPath, it doesn't work, we have subtle differences from one line to another.

@@ -167,7 +174,36 @@ func (nc *NextCloud) ListFiles(path string) ([]jsonapi.Object, error) {
return files, nil
}

func (nc *NextCloud) ListTrash(path string) ([]jsonapi.Object, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're not listing the content of the Trash but the content of a trashed item, I would suggest going for ListTrashed instead.
The same goes for buildTrashedUrl and TrashedName.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants