Fix bugs found in the audit
- People tiles resolve a bare photo filename to /uploads, via personPhoto - api.ts keeps the Accept header when a request sets its own headers - Feedback hashes IPs with auth.js's salt and client IP helper - Drop the better-sqlite3 fallback (not installed); require Node 22.13+ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9d8de0176e
commit
693dd84b6e
6 changed files with 15 additions and 56 deletions
|
|
@ -12,6 +12,7 @@ import { Link } from "react-router-dom";
|
|||
|
||||
import { get } from "../lib/api.ts";
|
||||
import { isBadId, personHref } from "../lib/hrefs.ts";
|
||||
import { personPhoto } from "../lib/media.ts";
|
||||
import "./PeopleTiles.css";
|
||||
|
||||
/**
|
||||
|
|
@ -547,7 +548,7 @@ function Tile({
|
|||
const content = (
|
||||
<span className="pl__frame">
|
||||
<span className="pl__photo">
|
||||
<Photo src={photoSrc(person.photo)} name={person.name} />
|
||||
<Photo src={personPhoto(person.photo)} name={person.name} />
|
||||
</span>
|
||||
<span className="pl__caption">
|
||||
<span className="pl__name">{person.name}</span>
|
||||
|
|
@ -760,13 +761,6 @@ function hasDetails(person: Person): boolean {
|
|||
);
|
||||
}
|
||||
|
||||
/* Database rows carry a bare filename; a hand-written entry may
|
||||
give a path or a full URL. Both should work. */
|
||||
function photoSrc(photo?: string | null): string | null {
|
||||
if (!photo) return null;
|
||||
if (/^(https?:|\/|data:)/.test(photo)) return photo;
|
||||
return `/people/${photo}`;
|
||||
}
|
||||
|
||||
function initials(name = ""): string {
|
||||
return name
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ export class ApiError extends Error {
|
|||
|
||||
async function request(path, options: RequestInit = {}) {
|
||||
const response = await fetch(`${BASE}${path}`, {
|
||||
headers: { Accept: "application/json", ...options.headers },
|
||||
...options,
|
||||
headers: { Accept: "application/json", ...options.headers },
|
||||
});
|
||||
|
||||
if (response.status === 204) return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue