Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

fix(util): addFromURL with URL-escaped file names #764

Merged
merged 1 commit into from
May 21, 2018

Conversation

lidel
Copy link
Contributor

@lidel lidel commented May 15, 2018

This PR solves double-URL-escaping problem happening when already escaped filename is added to IPFS via ipfs.util.addFromURL with wrap-with-directory=true.
(Originally issue found while working on ipfs/ipfs-companion#349)

How to reproduce

ipfs.util.addFromURL('https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Doma%C5%BElice%2C_Jir%C3%A1skova_43_%289102%29.jpg/320px-Doma%C5%BElice%2C_Jir%C3%A1skova_43_%289102%29.jpg?foo=bar#buzz', {wrapWithDirectory: true}, (err, result) => {
  if (err) {
    throw err
  }
  console.log(result)
})

Current behavior

Wrapping directory contains URL-escaped file name:

320px-Doma%C5%BElice%2C_Jir%C3%A1skova_43_%289102%29.jpg

Expected behavior

Wrapping directory should list file under original name:

320px-Domažlice,_Jiráskova_43_(9102).jpg

@lidel lidel requested a review from alanshaw May 15, 2018 14:05
@ghost ghost assigned lidel May 15, 2018
@ghost ghost added the in progress label May 15, 2018
alanshaw
alanshaw previously approved these changes May 16, 2018
Copy link
Contributor

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alanshaw alanshaw changed the title Fix addFromURL with URL-escaped file names fix(util): addFromURL with URL-escaped file names May 18, 2018
@lidel
Copy link
Contributor Author

lidel commented May 21, 2018

@alanshaw who is doing the merging in js-ipfs-api these days? You? :)

@alanshaw
Copy link
Contributor

Yes, let me rebase, tests should be passing now - one moment caller

@alanshaw alanshaw merged commit cd55fe9 into master May 21, 2018
@ghost ghost removed the in progress label May 21, 2018
@alanshaw alanshaw deleted the fix/add-from-url-encoding branch May 21, 2018 14:53
lidel added a commit to ipfs/ipfs-companion that referenced this pull request May 30, 2018
lidel added a commit to ipfs/ipfs-companion that referenced this pull request May 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants