Browse Source

Honor images.fix.orientation on uploads

rust-volume-server
Chris Lu 4 days ago
parent
commit
c07d05ed6e
  1. 1
      seaweed-volume/src/main.rs
  2. 5
      seaweed-volume/src/server/handlers.rs
  3. 1
      seaweed-volume/src/server/heartbeat.rs
  4. 2
      seaweed-volume/src/server/volume_server.rs
  5. 1
      seaweed-volume/src/server/write_queue.rs
  6. 1
      seaweed-volume/tests/http_integration.rs

1
seaweed-volume/src/main.rs

@ -327,6 +327,7 @@ async fn run(config: VolumeServerConfig) -> Result<(), Box<dyn std::error::Error
outgoing_grpc_tls,
metrics_runtime: std::sync::RwLock::new(RuntimeMetricsConfig::default()),
metrics_notify: tokio::sync::Notify::new(),
fix_jpg_orientation: config.fix_jpg_orientation,
has_slow_read: config.has_slow_read,
read_buffer_size_bytes: (config.read_buffer_size_mb.max(1) as usize) * 1024 * 1024,
security_file,

5
seaweed-volume/src/server/handlers.rs

@ -1797,7 +1797,10 @@ pub async fn post_handler(
// Fix JPEG orientation from EXIF data before storing (matches Go behavior).
// Only for non-compressed uploads that are JPEG files.
let body_data = if !is_gzipped && crate::images::is_jpeg(&mime_type, &path) {
let body_data = if state.fix_jpg_orientation
&& !is_gzipped
&& crate::images::is_jpeg(&mime_type, &path)
{
crate::images::fix_jpg_orientation(&body_data_raw)
} else {
body_data_raw

1
seaweed-volume/src/server/heartbeat.rs

@ -673,6 +673,7 @@ mod tests {
outgoing_grpc_tls: None,
metrics_runtime: std::sync::RwLock::new(Default::default()),
metrics_notify: tokio::sync::Notify::new(),
fix_jpg_orientation: false,
has_slow_read: true,
read_buffer_size_bytes: 4 * 1024 * 1024,
security_file: String::new(),

2
seaweed-volume/src/server/volume_server.rs

@ -89,6 +89,8 @@ pub struct VolumeServerState {
/// Metrics push settings learned from master heartbeat responses.
pub metrics_runtime: std::sync::RwLock<RuntimeMetricsConfig>,
pub metrics_notify: tokio::sync::Notify,
/// Whether JPEG uploads should be normalized using EXIF orientation.
pub fix_jpg_orientation: bool,
/// Read tuning flags for large-file streaming.
pub has_slow_read: bool,
pub read_buffer_size_bytes: usize,

1
seaweed-volume/src/server/write_queue.rs

@ -203,6 +203,7 @@ mod tests {
outgoing_grpc_tls: None,
metrics_runtime: std::sync::RwLock::new(RuntimeMetricsConfig::default()),
metrics_notify: tokio::sync::Notify::new(),
fix_jpg_orientation: false,
has_slow_read: true,
read_buffer_size_bytes: 4 * 1024 * 1024,
security_file: String::new(),

1
seaweed-volume/tests/http_integration.rs

@ -90,6 +90,7 @@ fn test_state_with_signing_key(signing_key: Vec<u8>) -> (Arc<VolumeServerState>,
seaweed_volume::server::volume_server::RuntimeMetricsConfig::default(),
),
metrics_notify: tokio::sync::Notify::new(),
fix_jpg_orientation: false,
has_slow_read: false,
read_buffer_size_bytes: 1024 * 1024,
security_file: String::new(),

Loading…
Cancel
Save