The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(attachments): reject unsupported media url schemes in history fallback
Steven Enamakel5ad0d4416f88
diff --git a/crates/openhuman-core/src/attachments/provider_owner.rs b/crates/openhuman-core/src/attachments/provider_owner.rsindex 01950369f0..66fe34c1fa 100644--- a/crates/openhuman-core/src/attachments/provider_owner.rs+++ b/crates/openhuman-core/src/attachments/provider_owner.rs@@ -274,7 +274,6 @@ impl MediaHistoryFallback<AttachmentAccessScope> for AttachmentModel {if !error.contains(super::super::SOURCE_MISSING_MARKER)&& !error.contains("attachments are disabled for this origin")&& !error.contains("remote attachment fetch is disabled")- && !error.contains("unsupported media URL scheme"){return None;}@@ -293,7 +292,7 @@ fn history_source_block(modality: InputModality, source: &str) -> ContentBlock {mime_type: None,}),modality => {- let media = if source.starts_with("data:") || source.contains("://") {+ let media = if !super::is_local_reference(source) {MediaRef::Url {url: source.to_owned(),media_type: None,diff --git a/crates/openhuman-core/src/attachments/provider_routing_tests.rs b/crates/openhuman-core/src/attachments/provider_routing_tests.rsindex e185abd692..076b1e8448 100644--- a/crates/openhuman-core/src/attachments/provider_routing_tests.rs+++ b/crates/openhuman-core/src/attachments/provider_routing_tests.rs@@ -635,3 +635,26 @@ async fn data_uri_payload_containing_a_url_is_not_treated_as_a_remote_source() {.text().contains("https://files.invalid/reference"));}++#[tokio::test]+async fn selected_historical_unsupported_media_url_still_fails_before_inference() {+ let temp = tempfile::tempdir().unwrap();+ let config = offline_config(temp.path());+ let transport = Arc::new(CaptureModel::new(vec![]));+ let model = controlled_wrapper(transport.clone(), config, &[]);+ let request = ModelRequest::new(vec![+ Message::User(UserMessage {+ content: vec![ContentBlock::Document(MediaRef::Url {+ url: "ftp://docs.example.test/current.pdf?signature=private".into(),+ media_type: Some("application/pdf".into()),+ })],+ }),+ Message::User(UserMessage {+ content: vec![ContentBlock::Text("continue".into())],+ }),+ ]);++ let error = model.invoke(&(), request).await.unwrap_err();+ assert!(error.to_string().contains("unsupported media URL scheme"));+ assert!(transport.requests.lock().unwrap().is_empty());+}