@putout/operator-filesystem 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/filesystem.js +7 -3
- package/package.json +1 -1
package/lib/filesystem.js
CHANGED
|
@@ -189,7 +189,7 @@ module.exports.createDirectory = (dirPath, name) => {
|
|
|
189
189
|
|
|
190
190
|
const createContentProperty = (content) => {
|
|
191
191
|
const contentKey = StringLiteral('content');
|
|
192
|
-
const contentValue = StringLiteral(btoa(content));
|
|
192
|
+
const contentValue = StringLiteral(btoa(encodeURI(content)));
|
|
193
193
|
|
|
194
194
|
return ObjectProperty(contentKey, contentValue);
|
|
195
195
|
};
|
|
@@ -198,8 +198,12 @@ module.exports.readFileContent = (filePath) => {
|
|
|
198
198
|
const [hasContent, content] = getFileContent(filePath);
|
|
199
199
|
|
|
200
200
|
if (hasContent) {
|
|
201
|
-
const [, decoded] = tryCatch(atob, content);
|
|
202
|
-
|
|
201
|
+
const [e, decoded] = tryCatch(atob, content);
|
|
202
|
+
|
|
203
|
+
if (!e)
|
|
204
|
+
return decodeURI(decoded);
|
|
205
|
+
|
|
206
|
+
return content;
|
|
203
207
|
}
|
|
204
208
|
|
|
205
209
|
const filename = getFilename(filePath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/operator-filesystem",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout operator adds ability to filesystem referenced variables that was not defined",
|