Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ const previewHeaderStyle = computed<CSSProperties>(() => ({
</div>
</div>
<!-- 浮窗图标 -->
<img :src="previewImages.float_icon || '/MaxKB.gif'" alt="" class="size-8 shrink-0 object-contain" />
<img :src="previewImages.float_icon || './MaxKB.gif'" alt="" class="size-8 shrink-0 object-contain" />
</div>
</template>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of the diff

Change: /MaxKB.gif → ./MaxKB.gif

Issues / Concerns

  1. Semantic change in path resolution (likely a regression risk)

    • /MaxKB.gif is an absolute path resolved from the site root (e.g., https://host/MaxKB.gif).
    • ./MaxKB.gif is relative to the current route URL, not the app's base. In SPA/Vue Router setups (especially with history mode and nested routes), this can resolve to incorrect URLs such as /some/nested/route/MaxKB.gif, causing 404s.
    • If the intent was "path relative to the deployed app root," use import.meta.env.BASE_URL + 'MaxKB.gif' or a static asset import (import MaxKBIcon from '@/assets/MaxKB.gif').
  2. No leading slash vs. Vite/base-path handling

    • With Vite, public assets are served from BASE_URL. Hardcoding ./ bypasses base-path configuration and will break if the app is deployed under a subpath (e.g., /maxkb/). Prefer:
      const defaultIcon = `${import.meta.env.BASE_URL}MaxKB.gif`
      then use :src="previewImages.float_icon || defaultIcon".
  3. Hardcoded fallback logic in template

    • Better to move the fallback into a computed property for clarity and testability, e.g.:
      const floatIconSrc = computed(() => previewImages.value.float_icon || defaultIcon)
  4. Accessibility

    • The <img> uses empty alt="". Since it's a UI icon (not decorative in the strict sense — it likely conveys meaning), consider alt="MaxKB" or mark it role="presentation"/aria-hidden="true" explicitly if truly decorative.
  5. Minor: filename casing

    • MaxKB.gif mixes case; confirm the actual file is capitalized exactly this way on case-sensitive servers (Linux), otherwise it works locally (Windows/macOS) but fails in production.

Recommendation

Revert to /MaxKB.gif or, preferably, switch to a base-URL-aware reference or a bundled asset import to make the path robust across environments.

Loading