Compare commits

..

1 Commits

Author SHA1 Message Date
c5efd771a3 feat: rewrite cache blobstore driver parameters parsing
All checks were successful
arcad/edge/pipeline/head This commit looks good
2023-12-03 14:26:18 +01:00
3 changed files with 8 additions and 13 deletions

View File

@ -132,17 +132,17 @@ func (s *Server) Exec(ctx context.Context, callableOrFuncname any, args ...inter
value := result.value
if promise, ok := IsPromise(value); ok {
return s.waitForPromise(promise), nil
value = s.waitForPromise(promise)
}
return value.Export(), nil
}
}
func (s *Server) waitForPromise(promise *goja.Promise) any {
func (s *Server) waitForPromise(promise *goja.Promise) goja.Value {
var (
wg sync.WaitGroup
value any
value goja.Value
)
wg.Add(1)
@ -162,7 +162,7 @@ func (s *Server) waitForPromise(promise *goja.Promise) any {
return
}
value = promise.Result().Export()
value = promise.Result()
breakLoop = true
})

View File

@ -2,7 +2,6 @@ package blob
import (
"encoding/json"
"io"
"io/fs"
"mime/multipart"
"net/http"
@ -165,14 +164,7 @@ func handleAppDownload(w http.ResponseWriter, r *http.Request) {
}
}()
// TODO Fix usage of ServeContent
// http.ServeContent(w, r, string(replyMessage.BlobInfo.ID()), replyMessage.BlobInfo.ModTime(), replyMessage.Blob)
w.Header().Add("Content-Type", replyMessage.BlobInfo.ContentType())
if _, err := io.Copy(w, replyMessage.Blob); err != nil {
logger.Error(ctx, "could not write blob", logger.CapturedE(errors.WithStack(err)))
}
http.ServeContent(w, r, string(replyMessage.BlobInfo.ID()), replyMessage.BlobInfo.ModTime(), replyMessage.Blob)
}
type uploadedFile struct {

View File

@ -8,6 +8,7 @@ import (
"forge.cadoles.com/arcad/edge/pkg/storage"
"forge.cadoles.com/arcad/edge/pkg/storage/driver"
"forge.cadoles.com/arcad/edge/pkg/storage/share"
"github.com/davecgh/go-spew/spew"
"github.com/pkg/errors"
)
@ -39,6 +40,8 @@ func documentStoreFactory(url *url.URL) (storage.DocumentStore, error) {
func blobStoreFactory(url *url.URL) (storage.BlobStore, error) {
dir := filepath.Dir(url.Host + url.Path)
spew.Dump(url.Host + url.Path)
if dir != "." {
if err := os.MkdirAll(dir, os.FileMode(0750)); err != nil {
return nil, errors.WithStack(err)