new task command api check whether specified url is base64 encoded

This commit is contained in:
MaysWind 2017-03-20 23:44:59 +08:00
parent 36ec36b58f
commit b8815e2cf7
3 changed files with 11 additions and 1 deletions

View file

@ -186,6 +186,7 @@ Input value is invalid!=输入的内容无效!
Protocol is invalid!=协议无效! Protocol is invalid!=协议无效!
RPC host cannot be empty!=RPC 主机不能为空! RPC host cannot be empty!=RPC 主机不能为空!
RPC secret is not base64 encoded!=RPC 密钥不是 Base64 编码后的字符串! RPC secret is not base64 encoded!=RPC 密钥不是 Base64 编码后的字符串!
URL is not base64 encoded!=指定 URL 不是 Base64 编码后的字符串!
Tap to configure and get started with AriaNg.=您还没有进行过设置, 点击这里进行设置. Tap to configure and get started with AriaNg.=您还没有进行过设置, 点击这里进行设置.
[error] [error]

View file

@ -190,6 +190,7 @@
'Protocol is invalid!': 'Protocol is invalid!', 'Protocol is invalid!': 'Protocol is invalid!',
'RPC host cannot be empty!': 'RPC host cannot be empty!', 'RPC host cannot be empty!': 'RPC host cannot be empty!',
'RPC secret is not base64 encoded!': 'RPC secret is not base64 encoded!', 'RPC secret is not base64 encoded!': 'RPC secret is not base64 encoded!',
'URL is not base64 encoded!': 'URL is not base64 encoded!',
'Tap to configure and get started with AriaNg.': 'Tap to configure and get started with AriaNg.', 'Tap to configure and get started with AriaNg.': 'Tap to configure and get started with AriaNg.',
'error': { 'error': {
'unknown': 'Unknown error occurred.', 'unknown': 'Unknown error occurred.',

View file

@ -19,7 +19,15 @@
if (path.indexOf('/new/') === 0) { if (path.indexOf('/new/') === 0) {
var base64Url = $routeParams.url; var base64Url = $routeParams.url;
var url = base64.urldecode(base64Url); var url = base64Url;
try {
url = base64.urldecode(base64Url);
} catch (ex) {
ariaNgCommonService.showError('URL is not base64 encoded!');
return;
}
$rootScope.loadPromise = newUrlDownload(url); $rootScope.loadPromise = newUrlDownload(url);
ariaNgLogService.info('[CommandController] new download: ' + url); ariaNgLogService.info('[CommandController] new download: ' + url);
} else if (path.indexOf('/settings/rpc/set/') === 0) { } else if (path.indexOf('/settings/rpc/set/') === 0) {