PDA

View Full Version : [Bug Report] appCache entries from app.json do not get URI encoded



danielappelt
19 Dec 2012, 10:14 AM
Version tested:

Sencha Cmd 3.0.0.250
Sencha Touch 2.1.0 GPL
Description:

Entries in the "appCache" section of the app.json file in a Senche Touch project are meant to be included in file cache.appcache that is generated when doing a production build. This does not work correctly if characters like spaces are part of the given entries.

Steps to reproduce the problem:

Add a path with special characters to the appCache section in your app.json file, create a production build, and try to use that build offline. Example entry in app.json:
"appCache": {
"cache": [
"lib/CryptoJS v3.0.2/rollups/sha256.js"
]

The result that was expected:

CACHE MANIFEST
# 014d2f8abd9c21670242d020b55b93de08b284a8
lib/CryptoJS%20v3.0.2/rollups/sha256.js

The result that occurs instead:

CACHE MANIFEST
# 014d2f8abd9c21670242d020b55b93de08b284a8
lib/CryptoJS v3.0.2/rollups/sha256.js

Possible fix:

Paths should be URI encoded when putting them into the appcache file. For Sencha Touch this may be achieved by changing function writeAppCache, line 704 in <Path to Sencha Cmd Installation>\Sencha\Cmd\3.0.0.250\plugins\touch\current\app-build.js

from

builder.append(cache.uri + "\n");

to

builder.append(encodeURI(cache.uri) + "\n");