Decode URI in asset server

Summary:
Solving this issue https://github.com/facebook/react-native/issues/10364

In development when assets are requested from AssetServer, it tries to find them with URI-friendly filenames. I added a single line to decode these filenames.

Tests are passing. Couldn't find any discussion regarding whether this is a good idea. This was causing some members of my team a bit of grief earlier.
Closes https://github.com/facebook/react-native/pull/10365

Differential Revision: D4168401

Pulled By: hramos

fbshipit-source-id: 9ed3606392d8a6f170998caaf0f9254ba4879b49
This commit is contained in:
Alexander Paterson 2016-11-14 11:38:09 -08:00 committed by Facebook Github Bot
parent d79372a56f
commit 475a0c20f6
2 changed files with 9 additions and 0 deletions

View File

@ -62,6 +62,14 @@ describe('getAssetDataFromName', () => {
name: 'c', name: 'c',
platform: 'ios', platform: 'ios',
}); });
expect(getAssetDataFromName('a/b /c.png')).toEqual({
resolution: 1,
assetName: 'a/b /c.png',
type: 'png',
name: 'c',
platform: null,
});
}); });
describe('resolution extraction', () => { describe('resolution extraction', () => {

View File

@ -42,6 +42,7 @@ function getAssetDataFromName(filename, platforms) {
} else { } else {
assetName = filename; assetName = filename;
} }
assetName = decodeURIComponent(assetName);
return { return {
resolution: resolution, resolution: resolution,