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

build_mock_url() give different paths for the same multipart request #42

Open
jmaspons opened this issue May 23, 2024 · 3 comments
Open

Comments

@jmaspons
Copy link
Contributor

I found that the paths on Linux/Mac are different from the Windows one. Only for multipart requests. Could explain the failing test in #40 (but not related to the form_data VS character content), see https://github.com/nealrichardson/httptest2/actions/runs/8881677497/job/24384594955?pr=40 or https://github.com/jmaspons/osmapiR/actions/runs/9210988574/job/25339688825

No idea how to fix it, and difficult to reproduce because it depends on the OS.

jmaspons added a commit to ropensci/osmapiR that referenced this issue May 23, 2024
@nealrichardson
Copy link
Owner

This feels familiar and I thought I had dealt with this before. My guess would be that it's a difference of path separators. Probably inserting a gsub("\\", "/", x) in there would standardize. (normalizePath() could do this but it also expands the path, and absolute paths will definitely not match across systems.)

@nealrichardson
Copy link
Owner

On #40 we saw this happening because of CRLF differences in text files. For multipart forms, if there is a curl::form_file(), we hash the file contents, not the file path, so backslashes shouldn't be relevant.

Reading the source in https://github.com/jmaspons/osmapiR (and in xml2), it wasn't obvious to me where that would be coming from. And even so, it's not obvious what to do about CRLF here, if anything.

@jmaspons
Copy link
Contributor Author

Seems that you spot the problem and the solutions at ropensci/osmapiR#28

We can close this issue documenting the trick in the readme or vignette

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

No branches or pull requests

2 participants