File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 7
7
"crypto/rsa"
8
8
"crypto/tls"
9
9
"crypto/x509"
10
+ "encoding/base64"
10
11
"encoding/xml"
11
12
"flag"
12
13
"fmt"
@@ -15,7 +16,6 @@ import (
15
16
"strings"
16
17
17
18
"github.com/crewjam/saml/samlsp"
18
- "github.com/dchest/uniuri"
19
19
"github.com/kr/pretty"
20
20
)
21
21
@@ -31,8 +31,14 @@ type Link struct {
31
31
// CreateLink handles requests to create links
32
32
func CreateLink (w http.ResponseWriter , r * http.Request ) {
33
33
account := r .Header .Get ("X-Remote-User" )
34
+
35
+ randomness := make ([]byte , 8 )
36
+ if _ , err := r .Body .Read (randomness ); err != nil {
37
+ http .Error (w , err .Error (), http .StatusInternalServerError )
38
+ return
39
+ }
34
40
l := Link {
35
- ShortLink : uniuri . New ( ),
41
+ ShortLink : base64 . RawURLEncoding . EncodeToString ( randomness ),
36
42
Target : r .FormValue ("t" ),
37
43
Owner : account ,
38
44
}
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ toolchain go1.24.2
6
6
7
7
require (
8
8
github.com/beevik/etree v1.5.0
9
- github.com/dchest/uniuri v1.2.0
10
9
github.com/golang-jwt/jwt/v4 v4.5.2
11
10
github.com/google/go-cmp v0.6.0
12
11
github.com/kr/pretty v0.3.1
Original file line number Diff line number Diff line change @@ -5,8 +5,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
5
5
github.com/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
6
6
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c =
7
7
github.com/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
8
- github.com/dchest/uniuri v1.2.0 h1:koIcOUdrTIivZgSLhHQvKgqdWZq5d7KdMEWF1Ud6+5g =
9
- github.com/dchest/uniuri v1.2.0 /go.mod h1:fSzm4SLHzNZvWLvWJew423PhAzkpNQYq+uNLq4kxhkY =
10
8
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI =
11
9
github.com/golang-jwt/jwt/v4 v4.5.2 /go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0 =
12
10
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI =
You can’t perform that action at this time.
0 commit comments