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

[FEATURE] Properties File Escaping #214

Merged
merged 10 commits into from
Jul 29, 2019
Merged

Conversation

tobiasso85
Copy link
Contributor

@tobiasso85 tobiasso85 commented Jul 22, 2019

serveResources uses stringEscaper to escape .properties files.

Builds on @ui5/builder#293
In order to make the tests work @ui5/builder#293 needs to be linked into the project.

@CLAassistant
Copy link

CLAassistant commented Jul 22, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@RandomByte RandomByte left a comment

Choose a reason for hiding this comment

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

Tests are failing

lib/middleware/serveResources.js Outdated Show resolved Hide resolved
lib/middleware/serveResources.js Outdated Show resolved Hide resolved
test/lib/server/middleware/serveResources.js Outdated Show resolved Hide resolved
matz3
matz3 previously requested changes Jul 26, 2019
lib/middleware/serveIndex.js Outdated Show resolved Hide resolved
lib/middleware/serveResources.js Outdated Show resolved Hide resolved
test/lib/server/main.js Outdated Show resolved Hide resolved
test/lib/server/main.js Outdated Show resolved Hide resolved
test/lib/server/main.js Outdated Show resolved Hide resolved
test/lib/server/main.js Show resolved Hide resolved
test/lib/server/middleware/serveResources.js Outdated Show resolved Hide resolved
test/lib/server/middleware/serveResources.js Outdated Show resolved Hide resolved
@tobiasso85
Copy link
Contributor Author

Tests are failing

In order to make the tests work @ui5/builder#293 needs to be linked into the project.

Copy link
Member

@RandomByte RandomByte left a comment

Choose a reason for hiding this comment

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

Fine with me. We need to wait for the release of SAP/ui5-builder#293 and then rebase this PR to have the tests pass

serveResources uses stringEscaper to escape .properties files.
propertiesFileEncoding -> propertiesSourceFileEncoding
propertiesSourceFileEncoding -> propertiesFileSourceEncoding
No special logic for properties files regarding charset and type.
The resource is drained because it is piped in the serveResources
middleware. Therefore the getStream and pipe functionality is stubbed.
Such that its content can be compared in the test.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 93.874% when pulling 62dd62f on properties-file-escaping into f7125e8 on master.

@RandomByte
Copy link
Member

Please squash and merge!

@tobiasso85 tobiasso85 merged commit dd4844d into master Jul 29, 2019
@tobiasso85 tobiasso85 deleted the properties-file-escaping branch July 29, 2019 14:56
type = mime.lookup(resourcePath) || "application/octet-stream";
// Special handling for *.properties files escape non ascii characters.
const nonAsciiEscaper = require("@ui5/builder").processors.nonAsciiEscaper;
const propertiesFileSourceEncoding = project && project.resources && project.resources.configuration && project.resources.configuration.propertiesFileSourceEncoding;
Copy link
Member

Choose a reason for hiding this comment

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

I think we missed something here 🤔

project is the root project. However, resources are taken from resources.all. So we rather need to look for the project on the resource. Just like we do in the lbt Bundler

We also need to add a test for this: A dependency tree of two projects, one with UTF-8 encoding and another one with ISO-8859-1, making sure that both are being processed correctly (stubs should be sufficient, no actual comparison of the results)

Copy link
Member

Choose a reason for hiding this comment

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

Should be resolved with: #219

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

Successfully merging this pull request may close these issues.

5 participants