feat(document): getThumbnailUrl appends URL-encoded timestamp as cache-buster

Matches the shape the frontend previously built via
encodeURIComponent(thumbnailGeneratedAt), so the backend is now the
single source of truth for the thumbnail URL convention (#309).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-23 21:55:55 +02:00
parent df260d5c64
commit 9862a51ac7
2 changed files with 27 additions and 1 deletions

View File

@@ -8,6 +8,8 @@ import org.hibernate.annotations.UpdateTimestamp;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.HashSet;
@@ -134,6 +136,8 @@ public class Document {
public String getThumbnailUrl() {
if (thumbnailKey == null) return null;
return "/api/documents/" + id + "/thumbnail";
String base = "/api/documents/" + id + "/thumbnail";
if (thumbnailGeneratedAt == null) return base;
return base + "?v=" + URLEncoder.encode(thumbnailGeneratedAt.toString(), StandardCharsets.UTF_8);
}
}