倍率问题和图片问题调整
This commit is contained in:
1 parent
f1993eb388
commit
3f29ba716a
20 files changed
+1210
-24
No files matched your search
@@ -245,6 +245,7 @@ func (s *Service) Upload(ctx context.Context, scope Scope, cmd UploadCommand) (A
|
||||
if s.blobs == nil {
|
||||
return Asset{}, errors.New("blob store is unavailable")
|
||||
}
|
||||
cmd.FileName, cmd.ContentType = normalizeImageFile(cmd.FileName, cmd.ContentType, cmd.Bytes)
|
||||
name := sanitizeFileName(cmd.FileName)
|
||||
key := path.Join("uploads", s.now().UTC().Format("2006-01-02"), s.id("file")+"-"+name)
|
||||
stored, err := s.blobs.Put(ctx, key, bytes.NewReader(cmd.Bytes), int64(len(cmd.Bytes)), cmd.ContentType)
|
||||
@@ -296,6 +297,7 @@ func (s *Service) ImportGenerated(ctx context.Context, scope Scope, cmd ImportGe
|
||||
if strings.TrimSpace(name) == "" {
|
||||
name = path.Base(strings.SplitN(cmd.URL, "?", 2)[0])
|
||||
}
|
||||
name, blob.ContentType = normalizeImageFile(name, blob.ContentType, content)
|
||||
if s.blobs == nil {
|
||||
return Asset{}, errors.New("blob store is unavailable")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user