Merge branch 'develop' of https://gitea.vvzvlad.xyz/vvzvlad/gitmost into develop
This commit is contained in:
@@ -42,6 +42,23 @@ export default function AvatarUploader({
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate file type. The `accept` attribute only filters the dialog;
|
||||
// a user can still select a non-image file, which previously failed
|
||||
// silently. Surface a visible error instead (issue #133). Accept any
|
||||
// image/* MIME (png, jpeg, webp, gif, svg, ...) so we don't narrow below
|
||||
// what the server accepts; only genuinely non-image files are rejected.
|
||||
if (!file.type.startsWith("image/")) {
|
||||
notifications.show({
|
||||
message: t("Unsupported image type"),
|
||||
color: "red",
|
||||
});
|
||||
// Reset the input
|
||||
if (fileInputRef.current) {
|
||||
fileInputRef.current.value = "";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate file size (max 10MB)
|
||||
const maxSizeInBytes = 10 * 1024 * 1024;
|
||||
if (file.size > maxSizeInBytes) {
|
||||
@@ -58,6 +75,8 @@ export default function AvatarUploader({
|
||||
|
||||
try {
|
||||
await onUpload(file);
|
||||
// Notify on success so the upload gives visible feedback (issue #128)
|
||||
notifications.show({ message: t("Image updated") });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
notifications.show({
|
||||
@@ -117,7 +136,7 @@ export default function AvatarUploader({
|
||||
type="file"
|
||||
ref={fileInputRef}
|
||||
onChange={handleFileInputChange}
|
||||
accept="image/png,image/jpeg,image/jpg"
|
||||
accept="image/*"
|
||||
aria-label={ariaLabel}
|
||||
tabIndex={-1}
|
||||
style={{ display: "none" }}
|
||||
|
||||
@@ -67,6 +67,7 @@ export default function RecentChanges({ spaceId }: Props) {
|
||||
<Badge
|
||||
color={getInitialsColor(page?.space.name)}
|
||||
variant="light"
|
||||
tt="none"
|
||||
component={Link}
|
||||
to={getSpaceUrl(page?.space.slug)}
|
||||
style={{ cursor: "pointer" }}
|
||||
|
||||
@@ -9,8 +9,10 @@ export function IconColumns4({ size = 24, stroke = 2 }: Props) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={rem(size)}
|
||||
height={rem(size)}
|
||||
// rem(size) returns a `calc(...)` string, which is invalid for the raw
|
||||
// SVG width/height length attributes ("Expected length, calc(...)"). Pass
|
||||
// it via CSS style instead (matching the other icon components).
|
||||
style={{ width: rem(size), height: rem(size) }}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
|
||||
@@ -9,8 +9,10 @@ export function IconColumns5({ size = 24, stroke = 2 }: Props) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={rem(size)}
|
||||
height={rem(size)}
|
||||
// rem(size) returns a `calc(...)` string, which is invalid for the raw
|
||||
// SVG width/height length attributes ("Expected length, calc(...)"). Pass
|
||||
// it via CSS style instead (matching the other icon components).
|
||||
style={{ width: rem(size), height: rem(size) }}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
|
||||
Reference in New Issue
Block a user