mirror of
https://github.com/ferdzo/fs.git
synced 2026-04-05 16:46:25 +00:00
Compare commits
3 Commits
cfec3afb49
...
feature/au
| Author | SHA1 | Date | |
|---|---|---|---|
| 46eb093d83 | |||
| 9abffd056e | |||
| cd7a1b4956 |
11
api/api.go
11
api/api.go
@@ -740,8 +740,15 @@ func (h *Handler) handleGetBucket(w http.ResponseWriter, r *http.Request) {
|
|||||||
query := r.URL.Query()
|
query := r.URL.Query()
|
||||||
|
|
||||||
if query.Has("location") {
|
if query.Has("location") {
|
||||||
xmlResponse := `<?xml version="1.0" encoding="UTF-8"?>
|
region := "us-east-1"
|
||||||
<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">us-east-1</LocationConstraint>`
|
if h.authSvc != nil {
|
||||||
|
candidate := strings.TrimSpace(h.authSvc.Config().Region)
|
||||||
|
if candidate != "" {
|
||||||
|
region = candidate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xmlResponse := fmt.Sprintf(`<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">%s</LocationConstraint>`, region)
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/xml; charset=utf-8")
|
w.Header().Set("Content-Type", "application/xml; charset=utf-8")
|
||||||
w.Header().Set("Content-Length", strconv.Itoa(len(xmlResponse)))
|
w.Header().Set("Content-Length", strconv.Itoa(len(xmlResponse)))
|
||||||
|
|||||||
@@ -763,8 +763,8 @@ func trimFloat(v float64) string {
|
|||||||
|
|
||||||
func escapeLabelValue(value string) string {
|
func escapeLabelValue(value string) string {
|
||||||
value = strings.ReplaceAll(value, `\`, `\\`)
|
value = strings.ReplaceAll(value, `\`, `\\`)
|
||||||
value = strings.ReplaceAll(value, "\n", `\\n`)
|
value = strings.ReplaceAll(value, "\n", `\n`)
|
||||||
value = strings.ReplaceAll(value, `"`, `\\"`)
|
value = strings.ReplaceAll(value, `"`, `\"`)
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ func (bs *BlobStore) saveBlob(chunkID string, data []byte) error {
|
|||||||
|
|
||||||
if err := os.Rename(tmpPath, fullPath); err != nil {
|
if err := os.Rename(tmpPath, fullPath); err != nil {
|
||||||
if _, statErr := os.Stat(fullPath); statErr == nil {
|
if _, statErr := os.Stat(fullPath); statErr == nil {
|
||||||
:q success = true
|
success = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ func NewConfig() *Config {
|
|||||||
MultipartCleanupRetention: time.Duration(
|
MultipartCleanupRetention: time.Duration(
|
||||||
envIntRange("MULTIPART_RETENTION_HOURS", 24, 1, 24*30),
|
envIntRange("MULTIPART_RETENTION_HOURS", 24, 1, 24*30),
|
||||||
) * time.Hour,
|
) * time.Hour,
|
||||||
AuthEnabled: envBool("AUTH_ENABLED", true),
|
AuthEnabled: envBool("AUTH_ENABLED", false),
|
||||||
AuthRegion: firstNonEmpty(strings.TrimSpace(os.Getenv("AUTH_REGION")), "us-east-1"),
|
AuthRegion: firstNonEmpty(strings.TrimSpace(os.Getenv("AUTH_REGION")), "us-east-1"),
|
||||||
AuthSkew: time.Duration(envIntRange("AUTH_SKEW_SECONDS", 300, 30, 3600)) * time.Second,
|
AuthSkew: time.Duration(envIntRange("AUTH_SKEW_SECONDS", 300, 30, 3600)) * time.Second,
|
||||||
AuthMaxPresign: time.Duration(envIntRange("AUTH_MAX_PRESIGN_SECONDS", 86400, 60, 86400)) * time.Second,
|
AuthMaxPresign: time.Duration(envIntRange("AUTH_MAX_PRESIGN_SECONDS", 86400, 60, 86400)) * time.Second,
|
||||||
|
|||||||
Reference in New Issue
Block a user