Skip to content

Commit

Permalink
修改请求长链接编码方式为 base64 encode
Browse files Browse the repository at this point in the history
  • Loading branch information
CareyWang committed Feb 12, 2020
1 parent aa6bd42 commit 12bfe87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
build/
build/

.idea/
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package main

import (
"bytes"
"encoding/base64"
"encoding/json"
"flag"
"fmt"
"github.com/gin-gonic/gin"
"github.com/go-redis/redis/v7"
"io/ioutil"
"net/http"
"net/url"
"time"
)

Expand Down Expand Up @@ -68,7 +68,8 @@ func main() {
return
}

longUrl, err := url.QueryUnescape(longUrl)
_longUrl, _ := base64.StdEncoding.DecodeString(longUrl)
longUrl = string(_longUrl)
res.LongUrl = longUrl

// 先查缓存
Expand Down

0 comments on commit 12bfe87

Please sign in to comment.