-
Notifications
You must be signed in to change notification settings - Fork 21
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
sourceURL -- does not work if basename(sourceURL) is not a valid filename #327
Comments
Do you mean that with e.g., a Dropbox file url there is a |
There are 2 issues here:
|
A work around for those a cloud service for which a direct link is not possible, could be:
|
I think this is easily doable with |
E.g., using the actual file url (not the browser-only one you get using the "shareable link" in google drive), the file name is contained in the headers. Get the actual file url by downloading the file in a web browser and right-click in the download manager to get the url. library(httr)
library(magrittr)
url <- "actual_url_goes_here"
ua <- user_agent(getOption("spades.useragent"))
request <- GET(url, ua, write_disk(tempfile()))
request$all_headers[[1]]$headers$`content-disposition` %>%
strsplit(";") %>%
`[[`(1) %>%
grep("filename=", ., value = TRUE) |
That approach seems to work for I was not able to get it to work for Google Drive. I think there are many file types that Google Driver intercepts. I tried with a .txt file and it opened a Google Docs editor instead of downloading the file. Following through with the download link there, I was able to download, copy the URL from the download manager, but that link did not have a file. Also, with large files, Google Drive gives you an error about not being able to scan such a large file. Here is a large file to try on Google Drive: |
Hmm I built my example using files on Google Drive (but they weren't large files). Perhaps large files are handled differently... Note that your file link doesn't work for me in the browser, but the shareable link does. |
That may be a symptom of part of the problem... the file link I gave works for me in my browser. So, there may be something more than just that file name that is required. I can access that file in the browser, but I can't access it using the code above (it does work, however, for sync.com, indicating that a) it does work, b) I used it correctly, but c) it is not universal enough) |
The direct URL changes using Google Drive -- I just tried from scratch on your file, and got a new url, which does work for me. |
Which means what? |
which means that you're correct about the lack of generalizability. clearly these platforms aren't intended for use in this way. |
What about this? If we get the file url while NOT logged into Google: |
Yes, that was how I was checking things. But I still get different links each time (your links above no longer work). My guess is that the direct file link is always different / time sensitive, whereas the google link is set up to redirect to a new file url each time. |
This issue was moved to PredictiveEcology/SpaDES.core#30 |
inside
downloadData
, the whole structure assumes that the sourceURL can provide a filename for the local file once downloaded. If this is a dropbox file, google drive file, or short URL, or many other cases, this will not work.Likely this requires a 4th column in the CHECKSUMS.txt file, indicating the sourceURL which goes with the local filename
The culprit line where it breaks is this:
The text was updated successfully, but these errors were encountered: