Skip to content

HD storage: honour the unlimited quota and reuse cached files; escape SVG output - #214

Merged
qisthidev merged 1 commit into
masterfrom
fix/hd-storage-cache-and-svg
Nov 7, 2026
Merged

qisthidev merged 1 commit into
masterfrom
fix/hd-storage-cache-and-svg

Conversation

@qisthidev

Copy link
Copy Markdown
Member

Fixes in the HD storage layer and the SVG builder. No public method signatures change.

HD storage

  • max_storage_mb = 0 now means no quota, as config/config-hd.php documents: checkStorageLimits() and cleanupLargeFiles() skip cleanup, and getStorageStatistics() reports 0.0 usage instead of dividing by zero.
  • getCachedUrl() applies the responsive size first, then uses one stable, content-addressed path ({hash}_{size}.{format}) for both the lookup and the write. Before, the lookup name included the size and a timestamp, so it never matched what export() wrote. export() keeps its existing naming.
  • generateCacheKey() (URL cache) includes colours, shape, font, border and the storage disk/directory.
  • cacheKey() (base64 cache) includes colours, font family and border radius.
  • HDAvatar imports the Storage facade used by createSpriteSheet().

SVG

  • toSvg() escapes the initials and the colour/font-family attribute values with htmlspecialchars(ENT_XML1 | ENT_QUOTES). The existing entity test now expects &.

Tests (all fail on master, pass here): quotes in SVG attributes, & in initials, zero quota means unlimited, URL cache key inputs, getCachedUrl() reuses its file.

Checked locally: vendor/bin/phpunit with --prefer-stable and --prefer-lowest (113 tests OK, same skips as master).

🤖 Generated with Claude Code

https://claude.ai/code/session_016ZbncuXneGAhsgTaizfjVi

- max_storage_mb = 0 now means no quota (as the config documents):
  no size cleanup, 0% usage in statistics, no division by zero.
- getCachedUrl() looks up and writes one stable, content-addressed
  file name instead of a timestamped one it could never find.
- The URL cache key includes colours, shape, font, border and the
  storage disk/directory; the toBase64 key includes colours, font
  family and border radius.
- toSvg() escapes initials and attribute values (ENT_XML1|ENT_QUOTES).
- HDAvatar imports the Storage facade it uses in createSpriteSheet().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ZbncuXneGAhsgTaizfjVi
@qisthidev
qisthidev merged commit 321bd18 into master Nov 7, 2026
10 checks passed
@qisthidev
qisthidev deleted the fix/hd-storage-cache-and-svg branch November 7, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant