Fixing more stuff

This commit is contained in:
2022-02-06 18:27:30 +01:00
parent 8bc01e0984
commit e582a75d9e
13 changed files with 56 additions and 38 deletions

View File

@@ -19,12 +19,6 @@ var assetsPayload struct {
}
func Assets(w http.ResponseWriter, r *http.Request) {
_, ok := authorizedSession(r)
if !ok {
w.WriteHeader(http.StatusUnauthorized)
return
}
switch r.Method {
case http.MethodGet:
assetsGet(w, r)
@@ -63,7 +57,7 @@ func assetsGet(w http.ResponseWriter, r *http.Request) {
request.Find(&assets)
for _, asset := range assets {
asset.Link = path.Join("/", config.SubPath, "assets", asset.Link)
asset.Link = path.Join(config.SubPath, "assets", asset.Link)
}
w.WriteHeader(http.StatusOK)
@@ -116,7 +110,7 @@ func assetsPost(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(schema.Asset{
Id: tmpDatabaseSchema.Id,
Name: tmpDatabaseSchema.Name,
Link: path.Join("/", config.SubPath, "assets", tmpDatabaseSchema.Link),
Link: path.Join(config.SubPath, "assets", tmpDatabaseSchema.Link),
})
}
}