fix: MIME type dynamique au lieu de 'image/png' hardcodé (causait 500 sur JPEG)
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Changelog — imagod-web v0.2.0+build.27-62e63e4-dirty</title>
|
<title>Changelog — imagod-web v0.2.0+build.28-42eff29-dirty</title>
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🖼️</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🖼️</text></svg>">
|
||||||
<style>
|
<style>
|
||||||
* { margin:0; padding:0; box-sizing:border-box; }
|
* { margin:0; padding:0; box-sizing:border-box; }
|
||||||
@@ -37,7 +37,7 @@ footer { text-align:center; color:#484f58; font-size:0.8rem; padding:2rem; }
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1>📋 imagod-web <span class="version-badge">v0.2.0+build.27-62e63e4-dirty</span></h1>
|
<h1>📋 imagod-web <span class="version-badge">v0.2.0+build.28-42eff29-dirty</span></h1>
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/">🖼️ Galerie</a>
|
<a href="/">🖼️ Galerie</a>
|
||||||
<a href="/changelog" class="active">📋 Changelog</a>
|
<a href="/changelog" class="active">📋 Changelog</a>
|
||||||
@@ -107,6 +107,6 @@ footer { text-align:center; color:#484f58; font-size:0.8rem; padding:2rem; }
|
|||||||
<h2>Légende des tags</h2>
|
<h2>Légende des tags</h2>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
<footer>imagod-web v0.2.0+build.27-62e63e4-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer>
|
<footer>imagod-web v0.2.0+build.28-42eff29-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Aide & Roadmap — imagod-web v0.2.0+build.27-62e63e4-dirty</title>
|
<title>Aide & Roadmap — imagod-web v0.2.0+build.28-42eff29-dirty</title>
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🖼️</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🖼️</text></svg>">
|
||||||
<style>
|
<style>
|
||||||
* { margin:0; padding:0; box-sizing:border-box; }
|
* { margin:0; padding:0; box-sizing:border-box; }
|
||||||
@@ -37,7 +37,7 @@ footer { text-align:center; color:#484f58; font-size:0.8rem; padding:2rem; }
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1>❓ imagod-web <span class="version-badge">v0.2.0+build.27-62e63e4-dirty</span></h1>
|
<h1>❓ imagod-web <span class="version-badge">v0.2.0+build.28-42eff29-dirty</span></h1>
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/">🖼️ Galerie</a>
|
<a href="/">🖼️ Galerie</a>
|
||||||
<a href="/changelog">📋 Changelog</a>
|
<a href="/changelog">📋 Changelog</a>
|
||||||
@@ -169,6 +169,6 @@ footer { text-align:center; color:#484f58; font-size:0.8rem; padding:2rem; }
|
|||||||
<p>5. <strong>Corriger le backend Imago</strong> (thumbnails, upload, stockage)</p>
|
<p>5. <strong>Corriger le backend Imago</strong> (thumbnails, upload, stockage)</p>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
<footer>imagod-web v0.2.0+build.27-62e63e4-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer>
|
<footer>imagod-web v0.2.0+build.28-42eff29-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -465,7 +465,7 @@
|
|||||||
<button class="btn" id="clear-btn" style="display:none">✕</button>
|
<button class="btn" id="clear-btn" style="display:none">✕</button>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn accent" id="header-upload-btn" onclick="document.getElementById('drop-zone').scrollIntoView({behavior:'smooth'}); document.getElementById('file-input').click()">📤 Upload</button>
|
<button class="btn accent" id="header-upload-btn" onclick="document.getElementById('drop-zone').scrollIntoView({behavior:'smooth'}); document.getElementById('file-input').click()">📤 Upload</button>
|
||||||
<span class="version-badge" id="version-badge">v0.2.0+build.27-62e63e4-dirty</span>
|
<span class="version-badge" id="version-badge">v0.2.0+build.28-42eff29-dirty</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ─── Navigation ─── -->
|
<!-- ─── Navigation ─── -->
|
||||||
|
|||||||
+2
-1
@@ -159,11 +159,12 @@ impl ImagoClient {
|
|||||||
&self,
|
&self,
|
||||||
data: Vec<u8>,
|
data: Vec<u8>,
|
||||||
filename: &str,
|
filename: &str,
|
||||||
|
mime_type: &str,
|
||||||
window_title: Option<&str>,
|
window_title: Option<&str>,
|
||||||
) -> Result<UploadResponse> {
|
) -> Result<UploadResponse> {
|
||||||
let part = multipart::Part::bytes(data)
|
let part = multipart::Part::bytes(data)
|
||||||
.file_name(filename.to_string())
|
.file_name(filename.to_string())
|
||||||
.mime_str("image/png")?;
|
.mime_str(mime_type)?;
|
||||||
|
|
||||||
let mut form = multipart::Form::new()
|
let mut form = multipart::Form::new()
|
||||||
.part("file", part);
|
.part("file", part);
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ async fn upload_image(
|
|||||||
hex::encode(&file_hash[..8.min(file_hash.len())])
|
hex::encode(&file_hash[..8.min(file_hash.len())])
|
||||||
);
|
);
|
||||||
|
|
||||||
match client.upload_image(data, &filename, None).await {
|
match client.upload_image(data, &filename, &mime_type, None).await {
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
// Marquer le hash dans la DB de dédoublonnage pour que le watcher
|
// Marquer le hash dans la DB de dédoublonnage pour que le watcher
|
||||||
// ne ré-upload pas ce fichier
|
// ne ré-upload pas ce fichier
|
||||||
|
|||||||
+1
-1
@@ -152,7 +152,7 @@ async fn upload_to_imago(imago: &ImagoClient, data: &[u8]) -> Option<i64> {
|
|||||||
tracing::info!("⬆️ Upload : {} ({} octets)", filename, data.len());
|
tracing::info!("⬆️ Upload : {} ({} octets)", filename, data.len());
|
||||||
|
|
||||||
match imago
|
match imago
|
||||||
.upload_image(data.to_vec(), &filename, None)
|
.upload_image(data.to_vec(), &filename, "image/png", None)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user