V3 S7 : preview cloud + export chiffré + release 1.2.0
Release / release-apk (push) Successful in 8m58s
Release / release-docker (push) Successful in 3m47s
CI / docker (push) Successful in 7s
CI / lint-backend (push) Successful in 1m44s
CI / lint-mobile (push) Failing after 18m59s
CI / test-backend (push) Successful in 2m12s
CI / test-mobile (push) Successful in 8m50s
CI / build-backend (push) Successful in 45s
Release / release-apk (push) Successful in 8m58s
Release / release-docker (push) Successful in 3m47s
CI / docker (push) Successful in 7s
CI / lint-backend (push) Successful in 1m44s
CI / lint-mobile (push) Failing after 18m59s
CI / test-backend (push) Successful in 2m12s
CI / test-mobile (push) Successful in 8m50s
CI / build-backend (push) Successful in 45s
Backend : resource_previews (000024), GET /files/:id/preview (JPEG
512, images pur Go, PDF page 1 via pdftoppm + poppler au Dockerfile,
cache régénéré sur changement, 404 NO_PREVIEW sinon), POST /export
{password 8+} -> zip AES-256 streamé (fichiers vifs possédés +
manifest.json avec faits, metadata-only sans octets). Deps :
alexmullins/zip, x/image directs. Tests service + handlers + migrations.
Mobile : vignettes distantes (une requête/session puis cache WebP
versionné, garde tried, icône sinon), FileThumbnail cloud-only,
export (mot de passe jamais persisté, cache + partage FileProvider),
bouton Partager ACTION_SEND. Impression papier reportée V4. FR/EN.
Contrat docs/api-v1.md, V3.md (S7 livré, V3 close), AGENTS.md,
VERSION 1.2.0 + CHANGELOG.
This commit is contained in:
+21
-11
@@ -129,6 +129,26 @@ var ErrInvalidLinkType = errors.New("invalid link type or pair")
|
||||
// hashPhysical computes the SHA-256 of the live bytes (safe resolution,
|
||||
// same pattern as OpenContent). Absent → ErrNotFound.
|
||||
func (s *Resources) hashPhysical(ownerID, resourceID string) (string, error) {
|
||||
resolved, err := s.resolvePhysical(ownerID, resourceID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
f, err := os.Open(resolved)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer f.Close()
|
||||
h := sha256.New()
|
||||
if _, err := io.Copy(h, f); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return hex.EncodeToString(h.Sum(nil)), nil
|
||||
}
|
||||
|
||||
// resolvePhysical returns the absolute path of the live bytes (safe :
|
||||
// 32-hex only, regular file, symlink contained in UploadDir).
|
||||
// Absent → repository.ErrNotFound.
|
||||
func (s *Resources) resolvePhysical(ownerID, resourceID string) (string, error) {
|
||||
if !idPattern.MatchString(ownerID) || !idPattern.MatchString(resourceID) {
|
||||
return "", repository.ErrNotFound
|
||||
}
|
||||
@@ -156,17 +176,7 @@ func (s *Resources) hashPhysical(ownerID, resourceID string) (string, error) {
|
||||
if err != nil || rel == ".." || strings.HasPrefix(rel, ".."+string(os.PathSeparator)) {
|
||||
continue
|
||||
}
|
||||
f, err := os.Open(resolved)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
h := sha256.New()
|
||||
if _, err := io.Copy(h, f); err != nil {
|
||||
f.Close()
|
||||
return "", err
|
||||
}
|
||||
f.Close()
|
||||
return hex.EncodeToString(h.Sum(nil)), nil
|
||||
return resolved, nil
|
||||
}
|
||||
return "", repository.ErrNotFound
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user