Made link a single word
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"TheAdversary/config"
|
||||
"TheAdversary/database"
|
||||
"TheAdversary/schema"
|
||||
"encoding/base64"
|
||||
@@ -56,6 +57,10 @@ func assetsGet(w http.ResponseWriter, r *http.Request) {
|
||||
var assets []schema.Asset
|
||||
request.Find(&assets)
|
||||
|
||||
for _, asset := range assets {
|
||||
asset.Link = "/" + path.Join(config.Prefix, "assets", asset.Link)
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode(&assets)
|
||||
}
|
||||
@@ -84,7 +89,7 @@ func assetsPost(w http.ResponseWriter, r *http.Request) {
|
||||
Name string
|
||||
Data []byte
|
||||
Link string
|
||||
}{Name: payload.Name, Data: rawData, Link: "/" + path.Join("assets", url.PathEscape(payload.Name))}
|
||||
}{Name: payload.Name, Data: rawData, Link: url.PathEscape(payload.Name)}
|
||||
|
||||
if database.GetDB().Table("assets").Clauses(clause.OnConflict{
|
||||
Columns: []clause.Column{{Name: "name"}},
|
||||
@@ -96,7 +101,7 @@ func assetsPost(w http.ResponseWriter, r *http.Request) {
|
||||
json.NewEncoder(w).Encode(schema.Asset{
|
||||
Id: tmpDatabaseSchema.Id,
|
||||
Name: tmpDatabaseSchema.Name,
|
||||
Link: tmpDatabaseSchema.Link,
|
||||
Link: "/" + path.Join(config.Prefix, "assets", tmpDatabaseSchema.Link),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user