Skip to content

Commit 4c74102

Browse files
authored
Merge pull request #32 from pointcloudtechnology/31-unify-unique-id-generation
Unify generation of unique identifier for resumable files
2 parents 9fcc317 + f5b1581 commit 4c74102

File tree

7 files changed

+10
-18
lines changed

7 files changed

+10
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
### Fixed
13+
* Unify generation of unique identifier for resumable files (#31)
1314

1415
### Changed
1516

dist/helpers.js

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/helpers.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/resumableHelpers.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default class ResumableHelpers {
55
*/
66
static stopEvent(e: Event): void;
77
/**
8-
* Generate a unique identifier for the given file based on its size, filename and relative path.
8+
* Generate a unique identifier for the given file based on its size and filename.
99
* @param {ExtendedFile} file The file for which the identifier should be generated
1010
* @returns {string} The unique identifier for the given file object
1111
*/

src/resumableHelpers.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@ export default class ResumableHelpers {
2626
}
2727

2828
/**
29-
* Generate a unique identifier for the given file based on its size, filename and relative path.
29+
* Generate a unique identifier for the given file based on its size and filename.
3030
* @param {ExtendedFile} file The file for which the identifier should be generated
3131
* @returns {string} The unique identifier for the given file object
3232
*/
3333
static generateUniqueIdentifier(file: ExtendedFile): string {
34-
let relativePath = file.webkitRelativePath || file.relativePath || file.name;
35-
// The '/' is used to display the relative path of the file. This information should be preserved
36-
relativePath = relativePath.replace('/', '-');
3734
// Remove special characters
38-
return (file.size + '-' + relativePath.replace(/[^0-9a-zA-Z_-]/img, ''));
35+
return (file.size + '-' + file.name.replace(/[^0-9a-zA-Z_-]/img, ''));
3936
}
4037

4138
/**

0 commit comments

Comments
 (0)