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

feat(node): allow and recommend to provide a specific root #574

Merged
merged 1 commit into from Feb 3, 2023

Conversation

skjnldsv
Copy link
Contributor

@skjnldsv skjnldsv commented Feb 3, 2023

This should ensure we are working from a specific point
This makes sense for most dav ressources

const file = new File({
	source: 'https://cloud.domain.com/remote.php/dav/files/emma/Photos/Berlin/picture.jpg',
	mime: 'image/jpeg',
	owner: 'emma',
	root: '/files/emma',
})

file.basename: 'picture.jpg'
file.extension: '.jpg'
file.dirname: '/Photos/Berlin'
file.path: '/Photos/Berlin/picture.jpg'
file.root: '/files/emma'
file.isDavRessource: true

@skjnldsv skjnldsv added the enhancement New feature or request label Feb 3, 2023
@skjnldsv skjnldsv self-assigned this Feb 3, 2023
@codecov
Copy link

codecov bot commented Feb 3, 2023

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (364866c) compared to base (e953b2a).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #574   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          160       170   +10     
  Branches        45        50    +5     
=========================================
+ Hits           160       170   +10     
Impacted Files Coverage Δ
lib/files/node.ts 100.00% <100.00%> (ø)
lib/files/nodeData.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
@ChristophWurst
Copy link
Contributor

What will the root be used for?

@skjnldsv
Copy link
Contributor Author

skjnldsv commented Feb 3, 2023

What will the root be used for?

Specifying the workdir for example.
It allow to scope the files you're working with to a specific service.

Like currently, if I get files from webdav and process them into File or Folder, I have no way of knowing their relative path (from the root).
Like in the files app, we use /Photos/Berlin/picture.jpg type of paths, not /files/emma/Photos/Berlin/picture.jpg

I could put them into the attributes, but I think it's cleaner as an official implementation.

@ChristophWurst
Copy link
Contributor

If you take the source, remove basename and dirname you already get the root, don't you? It sounds like there will be two approaches to achieve the same goal. Either you spec basename and dirname or source and root?

@skjnldsv
Copy link
Contributor Author

skjnldsv commented Feb 3, 2023

If you take the source, remove basename and dirname you already get the root, don't you? It sounds like there will be two approaches to achieve the same goal. Either you spec basename and dirname or source and root?

Well, you don't know the root
See the difference between files and trashbin:

Here the roots are respectively:

  • /trashbin/admin/trash
  • /files/admin

And we cannot detect this, so we have to manually be able to provide that information

@skjnldsv skjnldsv merged commit f83e79f into master Feb 3, 2023
@delete-merged-branch delete-merged-branch bot deleted the feat/root branch February 3, 2023 08:51
@skjnldsv skjnldsv mentioned this pull request Feb 3, 2023
@skjnldsv skjnldsv mentioned this pull request Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants