Browse Source

Add Https support

HonorLee 7 years ago
parent
commit
9b6106534c
1 changed files with 3 additions and 3 deletions
  1. 3 3
      handler/api.js

+ 3 - 3
handler/api.js

@@ -32,7 +32,7 @@ var API = {
                         if(!err && data){
                             var oldLink = req.param['url'];
                             if(req.param['base64'] && req.param['base64']==0){
-                                if(oldLink.match(/http:\/\//)){
+                                if(oldLink.match(/http(s)?:\/\//)){
                                     MongoHandler.getlink(req.param['key'],oldLink,res);
                                 }else{
                                     API._onError(ErrorMsg.URL_WRONG,res);
@@ -40,7 +40,7 @@ var API = {
                                 }
                             }else{
                                 oldLink = base64.decode(oldLink);
-                                if(oldLink.match(/http:\/\//)){
+                                if(oldLink.match(/http(s)?:\/\//)){
                                     MongoHandler.getlink(req.param['key'],oldLink,res);
                                 }else{
                                     API._onError(ErrorMsg.URL_WRONG,res);
@@ -118,7 +118,7 @@ const ErrorMsg = {
     KEY_LOST    :'Key is missing',
     KEY_WRONG   :'Key is incorrect',
     URL_LOST    :'URL is missing ',
-    URL_WRONG   :'URL must start with "http://"',
+    URL_WRONG   :'URL must start with "http://" or "https://"',
     MAKE_ERROR  :'Short link generate error,please contact with l2s.ch'
 }