mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-27 17:54:11 +00:00
feature(cloudfunc) rm rmLastSlash
This commit is contained in:
parent
afeb59b1ca
commit
a4a18fe920
6 changed files with 15 additions and 66 deletions
|
|
@ -69,30 +69,10 @@ var Util;
|
|||
else
|
||||
name = '';
|
||||
|
||||
|
||||
msg = msg + ': ' + status + name;
|
||||
|
||||
return msg;
|
||||
};
|
||||
/**
|
||||
* Функция убирает последний слеш,
|
||||
* если он - последний символ строки
|
||||
*/
|
||||
this.rmLastSlash = function(path) {
|
||||
var length, lastSlash, isEqual;
|
||||
|
||||
if (typeof path !== 'string')
|
||||
throw(Error('path should be a string!'));
|
||||
|
||||
length = path.length - 1;
|
||||
lastSlash = path.lastIndexOf('/');
|
||||
isEqual = lastSlash === length;
|
||||
|
||||
if (length && isEqual)
|
||||
path = path.substr(path, length);
|
||||
|
||||
return path;
|
||||
};
|
||||
|
||||
/** Функция возвращает заголовок веб страницы
|
||||
* @pPath
|
||||
|
|
@ -173,14 +153,8 @@ var Util;
|
|||
*/
|
||||
htmlPath = getPathLink(path, template.pathLink),
|
||||
|
||||
/* Убираем последний слэш
|
||||
* с пути для кнопки обновить страницу
|
||||
* если он есть
|
||||
*/
|
||||
refreshPath = CloudFunc.rmLastSlash(path),
|
||||
|
||||
fileTable = rendy(template.path, {
|
||||
link : FS + refreshPath,
|
||||
link : FS + path,
|
||||
fullPath : path,
|
||||
path : htmlPath
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue