mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Fixed wrong name of obfuscated files when input directory path is the . symbol
https://github.com/javascript-obfuscator/javascript-obfuscator/issues/816
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
Change Log
|
||||
|
||||
v2.9.3
|
||||
---
|
||||
* **CLI**: Fixed wrong name of obfuscated files when input directory path is the `.` symbol. https://github.com/javascript-obfuscator/javascript-obfuscator/issues/816
|
||||
|
||||
v2.9.2
|
||||
---
|
||||
* Ignore object expressions as body of arrow function expression when `transformObjectKeys` option is enabled. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/813
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "javascript-obfuscator",
|
||||
"version": "2.9.2",
|
||||
"version": "2.9.3",
|
||||
"description": "JavaScript obfuscator",
|
||||
"keywords": [
|
||||
"obfuscator",
|
||||
|
||||
@@ -60,7 +60,11 @@ export class ObfuscatedCodeWriter {
|
||||
|
||||
if (isDirectoryRawInputPath) {
|
||||
if (isDirectoryRawOutputPath) {
|
||||
const baseOutputPath: string = normalizedFilePath.replace(this.inputPath, '');
|
||||
const parsedNormalizedFilePath: path.ParsedPath = path.parse(normalizedFilePath);
|
||||
const baseOutputPath: string = path.join(
|
||||
parsedNormalizedFilePath.dir.replace(this.inputPath, ''),
|
||||
parsedNormalizedFilePath.base
|
||||
);
|
||||
|
||||
return path.join(normalizedRawOutputPath, baseOutputPath);
|
||||
} else {
|
||||
|
||||
@@ -197,6 +197,60 @@ describe('ObfuscatedCodeWriter', () => {
|
||||
assert.equal(outputCodePath, expectedOutputCodePath);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #5: input directory name with dot only', () => {
|
||||
const inputPath: string = path.join('test-input.js');
|
||||
const rawInputPath: string = path.join('.');
|
||||
const rawOutputPath: string = path.join(tmpDirectoryPath, 'output');
|
||||
const expectedOutputCodePath: string = path.join(
|
||||
tmpDirectoryPath,
|
||||
'output',
|
||||
'test-input.js'
|
||||
);
|
||||
|
||||
let outputCodePath: string;
|
||||
|
||||
before(() => {
|
||||
const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
|
||||
rawInputPath,
|
||||
{
|
||||
output: rawOutputPath
|
||||
}
|
||||
);
|
||||
outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
|
||||
});
|
||||
|
||||
it('should return output path that contains raw output path and actual file input path', () => {
|
||||
assert.equal(outputCodePath, expectedOutputCodePath);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #6: input directory name with dot and slash only', () => {
|
||||
const inputPath: string = path.join('test-input.js');
|
||||
const rawInputPath: string = path.join('./');
|
||||
const rawOutputPath: string = path.join(tmpDirectoryPath, 'output');
|
||||
const expectedOutputCodePath: string = path.join(
|
||||
tmpDirectoryPath,
|
||||
'output',
|
||||
'test-input.js'
|
||||
);
|
||||
|
||||
let outputCodePath: string;
|
||||
|
||||
before(() => {
|
||||
const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
|
||||
rawInputPath,
|
||||
{
|
||||
output: rawOutputPath
|
||||
}
|
||||
);
|
||||
outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
|
||||
});
|
||||
|
||||
it('should return output path that contains raw output path and actual file input path', () => {
|
||||
assert.equal(outputCodePath, expectedOutputCodePath);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #5: Win32 environment', () => {
|
||||
|
||||
Reference in New Issue
Block a user