1
0
mirror of https://github.com/adobe/brackets.git synced 2024-11-20 09:53:00 +01:00

Correcting file name if file path ends with forward slash (#14323)

This commit is contained in:
Naveen Choudhary 2018-05-12 09:31:06 +05:30 committed by Swagatam Mitra
parent c4d4684bfe
commit ca5d2ae060

View File

@ -44,6 +44,17 @@ define(function (require, exports, module) {
hash: uri
});
}
function _getFileName(filePath) {
var fileName = filePath.split('/').pop();
if (!fileName.trim()) {
fileName = filePath.trim().slice(0, -1);
fileName = fileName.split('/').pop();
}
return fileName;
}
/**
* Model for a RemoteFile.
@ -62,7 +73,7 @@ define(function (require, exports, module) {
this._path = fullPath;
this._stat = _getStats(fullPath);
this._id = fullPath;
this._name = fullPath.split('/').pop();
this._name = _getFileName(fullPath);
this._fileSystem = fileSystem;
this.donotWatch = true;
this.protocol = protocol;