mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-06 05:02:58 +03:00
fix: allow any image source but disallow base64
This commit is contained in:
@@ -34,7 +34,7 @@ func (m *CspMiddleware) Add() gin.HandlerFunc {
|
||||
"object-src 'none'; " +
|
||||
"frame-ancestors 'none'; " +
|
||||
"form-action 'self'; " +
|
||||
"img-src 'self' data: blob:; " +
|
||||
"img-src * blob:;" +
|
||||
"font-src 'self'; " +
|
||||
"style-src 'self' 'unsafe-inline'; " +
|
||||
"script-src 'self' 'nonce-" + nonce + "'"
|
||||
|
||||
@@ -35,12 +35,7 @@
|
||||
|
||||
isLoading = true;
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = (event) => {
|
||||
imageDataURL = event.target?.result as string;
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
imageDataURL = URL.createObjectURL(file);
|
||||
await updateCallback(file).catch(() => {
|
||||
imageDataURL = cachedProfilePicture.getUrl(userId);
|
||||
});
|
||||
|
||||
@@ -31,12 +31,7 @@
|
||||
if (!file) return;
|
||||
|
||||
image = file;
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = (event) => {
|
||||
imageDataURL = event.target?.result as string;
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
imageDataURL = URL.createObjectURL(file);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -115,9 +115,7 @@
|
||||
} else {
|
||||
logo = input;
|
||||
$inputs.logoUrl && ($inputs.logoUrl.value = '');
|
||||
const reader = new FileReader();
|
||||
reader.onload = (event) => (logoDataURL = event.target?.result as string);
|
||||
reader.readAsDataURL(input);
|
||||
logoDataURL = URL.createObjectURL(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user