mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
Append trailingSlash if not present on path param
In some cases the incoming ```path``` variable may not necessarily contain a trailing slash, but in cases where the directory path is manually built within the plugin this was not protected against. This shouldn't be a big issue if consumers are using ```cordova.file.*``` for the path params, but not all consumers may be using this.
This commit is contained in:
parent
94de6b43d9
commit
ce2772b994
@ -50,7 +50,11 @@ export class File {
|
||||
if ((/^\//.test(dir))) {
|
||||
rejectFn('directory cannot start with \/');
|
||||
}
|
||||
|
||||
|
||||
if (!(/\/$/.test(noSlash))) {
|
||||
path += "/";
|
||||
}
|
||||
|
||||
try {
|
||||
var directory = path + dir;
|
||||
|
||||
@ -351,6 +355,10 @@ export class File {
|
||||
rejectFn('file cannot start with \/');
|
||||
}
|
||||
|
||||
if (!(/\/$/.test(noSlash))) {
|
||||
path += "/";
|
||||
}
|
||||
|
||||
try {
|
||||
var directory = path + file;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user