Fix 404 on the header logo caused by an encoded query string

base.html passed the cache-busting query string INSIDE the filename argument:

    url_for('static', filename='uploads/header_logo.png?v=1')

Flask percent-encodes the '?' to '%3F', producing a request for a file
literally named "header_logo.png%3Fv=1", which does not exist. Every
authenticated page therefore logged:

    GET /static/uploads/header_logo.png%3Fv=1 404

The logo silently stayed hidden too, because the element carries
onerror="this.style.display='none'".

Changes:
- base.html / login.html: append "?v=..." OUTSIDE url_for(), matching what
  admin/customize_logos.html already did correctly.
- Inject logo_version from a context processor instead of hardcoding it.
  It is derived from the newest logo's mtime, so uploading a new logo in
  Admin -> Customize Logos is reflected immediately. The previous value was
  a literal 1, which defeated cache-busting entirely; login.html used
  range(1, 999999) | random, which changed on every request and made the
  logo uncacheable.

Verified: /, /content/ and /players/ now render
/static/uploads/header_logo.png?v=<mtime> (HTTP 200), and no %3F requests
appear in the logs.
This commit is contained in:
2026-09-11 13:18:29 +03:00
parent 46602f1933
commit 57b7810069
3 changed files with 22 additions and 2 deletions
+1 -1
View File
@@ -376,7 +376,7 @@
<header>
<div class="container">
<h1>
<img src="{{ url_for('static', filename='uploads/header_logo.png?v=1') }}" alt="DigiServer" style="height: 32px; width: auto; margin-right: 8px;" onerror="this.style.display='none';" onload="this.style.display='inline';">
<img src="{{ url_for('static', filename='uploads/header_logo.png') }}?v={{ logo_version }}" alt="DigiServer" style="height: 32px; width: auto; margin-right: 8px;" onerror="this.style.display='none';" onload="this.style.display='inline';">
DigiServer
</h1>
<nav>