all repos — felt @ 0d3b4fb5aeecd86b0356d618d3b76cf8d6acec38

virtual tabletop for dungeons and dragons (and similar) using Go, MongoDB, and websockets

gofmt lol
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmSlGdgACgkQO3+8IhRO
Y5gNJw//e4qP4pBGdonge8b58+/aEpYEaqbC1pR7+EqfB8D/PHVzhXZ2qDVW2xGZ
AQlhHintF+22sVnmxDb/9YClhnMFCqHrwmBSLiVJDu5H8wUSvpUJNNXJo4548TKE
XwHPbFUTXjUUtY23sSjAlMMpwOQrdcyxoTWf6QsmK/beBcKvcH1hapQ7Q4+cLQk0
VWmwJ/ZJvn4RPIvoF+au+lZ00+Xs6je5cCaAZq2kXLujXw3hfYhIAWOnAK9fIlu5
9tVrEEWHFEInlExeBYReBeNbGIbMv3qzGwJaYxUU47uoDdT7h3vdB6GbIhYKgH8O
TyLXxiwhANSKxd96pbKrwPLBMwncF9V5hdrehxE7PJDHKF8Pwv1obML7ZBcIFZ30
jFDVgcthTK8lwGKI0+KBRFdwcG5LcR3cZuoBVEi4ffk4/7FAEIjaa9gcn274SBVF
6tGucRSG3iWaWmyJcEypRdqrCFzVf4fmhtapInFXyh/Z39mcDbVruRVzaQbJ2MQA
ALXpKwwWnr61h9QzJ+QOqC31E9SY7hs6V4KvoO+gJP2ZXRmqA/9mVRWLhzzlxpvq
uG4Lnx9U6y8dARQZ4pPtDEzKRkgd+NBdlItPwOar1/HkJjOahdixbQuw7YHt11Td
6GU6zSnpCmyBcFQTHm+DZTR8rA43TddBV+sb6JBjqDIL/C8K+88=
=p95S
-----END PGP SIGNATURE-----
commit

0d3b4fb5aeecd86b0356d618d3b76cf8d6acec38

parent

825f2ac762a2506f5c2146182663fc5a5c30fc29

2 files changed, 19 insertions(+), 20 deletions(-)

jump to
M admin/admin.goadmin/admin.go

@@ -273,11 +273,10 @@ return

} } } - w.WriteHeader(422) - next.ServeHTTP(w, req) - return + w.WriteHeader(422) + next.ServeHTTP(w, req) + return } - return http.HandlerFunc(handlerFunc) }

@@ -285,7 +284,7 @@

func apiDeleteImage(next http.Handler, uploads string, uploadType string, udb auth.UserStore, dbAdapter mongodb.DbAdapter) http.Handler { handlerFunc := func(w http.ResponseWriter, req *http.Request) { // put the path together -urlParams := req.Context().Value("params").(map[string]string) + urlParams := req.Context().Value("params").(map[string]string) tableName := urlParams["table"] tableKey := models.TableKey{ Name: tableName,

@@ -308,20 +307,20 @@ }

if ok { if dbAdapter.CheckTable(tableKey) { - // if the file exists, delete it and return 201 - filename := urlParams["file"] - fullPath := filepath.Join(uploads, tableName, uploadType, filename) - s, err := os.Stat(fullPath) - if err == nil && !s.IsDir() { - err = os.Remove(fullPath) - if err == nil { - w.WriteHeader(201) - next.ServeHTTP(w, req) - return - } - } - } - } + // if the file exists, delete it and return 201 + filename := urlParams["file"] + fullPath := filepath.Join(uploads, tableName, uploadType, filename) + s, err := os.Stat(fullPath) + if err == nil && !s.IsDir() { + err = os.Remove(fullPath) + if err == nil { + w.WriteHeader(201) + next.ServeHTTP(w, req) + return + } + } + } + } } // otherwise, return an error w.WriteHeader(500)
M gametable/server.gogametable/server.go

@@ -172,7 +172,7 @@ if err != nil {

fmt.Println(err.Error()) return } - + self.publishLimiter.Wait(context.Background()) for s, k := range self.subscribers {