-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Indicate that a file is uploading because user has chosen a folder #2605
Conversation
@@ -1,4 +1,4 @@ | |||
const { h, Component } = require('preact') | |||
const { Component } = require('preact') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI, I had to remove this unused import because Travis/npm run lint
were complaining.
Hi @chiefGui, I'd like to get some more clarifications here, what exactly is happening when you say "reconstructing folder structure", and how are you able to achieve it when a file is selected directly vs when a file is selected through a parent folder? |
Hello @ifedapoolarewaju, thank you for your answer. Pretty much, Dropbox files are giving me Turns out I can't differentiate a "standalone" file, and a file from a folder, meaning direct files are always recreating their parent folder structure and that's not desired—I only want to recreate the structure if the files uploaded were selected through folder picking. What do you think? Am I making sense? |
@chiefGui, thanks, that makes sense! One issue with this PR is in docs we mention that
|
Hey @lakesare, thank you for the quick reply. Yes, hands down on exposing Now, am not sure if those points you raised were internal-only but I'll participate anyways for what it's worth.
Asking these for me to update the PR accordingly. |
Oh, before I forget. Do you want me to expose cc @lakesare |
@chiefGui, sorry for the delay, talked over it in Slack.
Deal then 👍
We discussed this, and agreed that |
@chiefGui, is the PR ready for review? |
Hey @lakesare, sorry for the delay. Yes, I guess it's now ready for review, although there are a few considerations I want to bring to the table.
It's been a while since I last touched this code. I wrote the code you see here and published our own Uppy's version shortly after just to respect our deadlines, and just now I've got a chance to give you feedback—so pardon me for any confusing explanation or rationale. In a nutshell, that's all about it. Let me know what you think and count on me to update whatever is needed to match your expectations to have this update out. 🚀 |
files = files || [] | ||
return new Promise((resolve, reject) => { | ||
this.provider.list(path).then((res) => { | ||
let itemsRelativePath | ||
|
||
if (meta) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea on having this condition here is that if there's a meta, then there's a previousRelativePath
and a currentFolder
. That's why I skipped checking those individual properties.
@@ -430,11 +447,23 @@ module.exports = class ProviderView { | |||
} | |||
} | |||
|
|||
listAllFiles (path, files = null) { | |||
listAllFiles (path, files = null, meta = undefined) { | |||
files = files || [] | |||
return new Promise((resolve, reject) => { | |||
this.provider.list(path).then((res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This res
is where we'd need currentFolderName
. Currently, if moreFiles === true
, this implementation won't reproduce the correct parent's folder names for Google Drive and OneDrive since their IDs are unique, hashed strings instead of folder names (IMHO, Dropbox took the cleverest approach here).
FWIW, the relativePath
in the data
object is giving /{fileId}
; and this is the reason that the above statement is relevant.
Read more at #2605 (comment).
I am already considering this as a dead pull request that won't go anywhere but the graveyard. However, am curious - did you guys fix the issue and just forgot to flag here? |
Hi, sorry your contribution went stale. Looking at this PR I'm not convinced about the current state to merge it. It seems like quite a lot of changes for something that in my mind only needs something similar to what you said:
I'm not a fan of opening the box on adding things like If we only add |
@Murderlon My solution is completely front-end oriented. Given the context I was in, that's the best I could achieve—and am telling you this to quite justify the decisions I took in this Pull Request. The above said I agree with you: the less noise we have on the (front-end) API (by omitting things like Meaning...
may work if, with it, we can reconstruct the folder directory of a certain uploading/uploaded file. |
I can take a look at this but I have some other things to do first. One could also say this is a server-side concern, for which we could add it to the response for every provider, such as here for Google Drive: uppy/packages/@uppy/companion/src/server/provider/drive/index.js Lines 31 to 52 in d42badf
|
My vote would be let's go 100% server-side if you ask me.
I mean, it's yet unknown to me what the consequences are of relying on a front-end solution for this specific case (although my solution worked just fine for the last 2 years). |
I created a new issue for this, closing this PR. |
Hello, there!
The idea behind this PR is simple: when a file is being added through a folder selection from a provider using ProviderView, I need an indication of that. I am reconstructing folder structure from files uploaded via Dropbox/Google Drive, but unfortunately, if I don't know whether the file was picked because the user has selected a folder, I'll be always reconstructing the folder path exposed by the mentioned provider.
This line of code is all that's needed to achieve that.
Please, let me know if you need further clarification.