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

DND to download out of remote doesn't work #116989

Open
roblourens opened this issue Feb 19, 2021 · 8 comments
Open

DND to download out of remote doesn't work #116989

roblourens opened this issue Feb 19, 2021 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Milestone

Comments

@roblourens
Copy link
Member

  • Drag a file from the explorer to Finder

  • It tries to download, but the browser says "Couldn't download - No File"
    image

  • But right click -> download works fine

@isidorn isidorn added bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues labels Feb 19, 2021
@isidorn isidorn added this to the Backlog milestone Feb 19, 2021
@isidorn
Copy link
Contributor

isidorn commented Feb 19, 2021

Yeah we could not get this to work via the chrome data transfer protocol, thus we adde the download action as an alternative solution sort of.
So this is a limitation right now.

@roblourens
Copy link
Member Author

roblourens commented Feb 20, 2021

It also is not working for Desktop + SSH for me right now, which I think used to work?

But in cases where we know it doesn't work is it possible to disable the DND entirely?

@isidorn
Copy link
Contributor

isidorn commented Feb 22, 2021

Yeah we should disable when we know it does not work, there is another issue for this.
Next milestone I can discuss to put this on the plan so I have time.

@isidorn
Copy link
Contributor

isidorn commented May 28, 2021

Desktop + SSH no longer works because previously we had code that handled VS Code remote resources here. However @alexdima removed that code because it was a temporary workaround and there are no plans to support this again.

As for the drag and drop from Codespaces, the following happens: we detect a remote scheme and write the download_url here and we rewrite the URI, however when the file is downloaded the URI can not be accessed and thus the download can not happen.
So it seems that the only way for this to work was if the URL to access a particular resource in Codespaces was accessible from the outside which is not.
It is not possible to write a full content of the file in the downloadURL data transfer type. Reference
Thus I do not see how we can fix this. I am open for ideas though. @bpasero might have some since he looked in this area recently.

We can not disable the DND entirely because it is still possible to DND inside the explorer from one folder to another. And when the user starts the drag we do not know where he will want to drop..

@isidorn isidorn added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label May 28, 2021
@alexdima
Copy link
Member

@isidorn only in the desktop case: the vscode-remote-resource: URL could be converted to an http: URL by doing url.replace(/^vscode-remote-resource:/, 'http:')

@bpasero
Copy link
Member

bpasero commented Jun 1, 2021

however when the file is downloaded the URI can not be accessed and thus the download can not happen

I think why this happens is the interesting question because the code seems to be doing the right thing:

event.dataTransfer.setData(DataTransfers.DOWNLOAD_URL, [MIME_BINARY, basename(firstFile.resource), FileAccess.asBrowserUri(firstFile.resource).toString()].join(':'));

Specifically FileAccess.asBrowserUri is proper for creating a link that can be embedded into the browser and I verified that in Codespaces (web) this produces a HTTPS URI.

I believe this may be an issue with service workers implementing that file access in the Codespace case (e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=741778&q=service%20worker%20download&can=2)

@isidorn
Copy link
Contributor

isidorn commented Jun 3, 2021

Just for reference, here's the example HTTPS URI that gets created when I DnD an app.js from the smoke test express codespace:

https://isidorn-microsoft-vscode-smoketest-express-m4hq.github.dev/assets/35436398758ECA9A1BFEB672CCDC768E9785/40955/vscode-remote-resource?path=%2Fworkspaces%2Fvscode-smoketest-express%2Fapp.js&tkn=SOME_TOKEN
If I use this URI just from the browser I can not access the file. Not sure if it should just work but I would expect the file got get download if I just access it.

@bpasero
Copy link
Member

bpasero commented Jun 3, 2021

This may require a service worker to be running to implement the fetch, not sure it would work directly from the browser address bar.

//cc @legomushroom

@isidorn isidorn assigned JacksonKearl and unassigned isidorn Aug 12, 2021
@lramos15 lramos15 assigned lramos15 and unassigned JacksonKearl May 25, 2022
@lramos15 lramos15 changed the title DND to download out of codespaces doesn't work DND to download out of remote doesn't work Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

6 participants