Skip to content

Commit

Permalink
Limit the number of characters in the URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Valls Fernández committed Jun 13, 2020
1 parent db5a784 commit aa12a0c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ func main() {

go http.Serve(ln, nil)

q, _ := qrcode.New("http://"+ln.Addr().String()+"/"+url.QueryEscape(fileName), qrcode.RecoveryLevel(0))
urlFileName := url.QueryEscape(fileName)
if len(urlFileName) > 40 {
urlFileName = urlFileName[0:40]
}

q, _ := qrcode.New("http://"+ln.Addr().String()+"/"+urlFileName, qrcode.RecoveryLevel(0))
bm, _ := walk.NewBitmapFromImage(q.Image(size))

MainWindow{
Expand Down

0 comments on commit aa12a0c

Please sign in to comment.