diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 33246ee..035b436 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -35,4 +35,4 @@ jobs: context: . platforms: linux/amd64 push: ${{ github.event_name != 'pull_request' }} - tags: ghcr.io/fg-devs/attachment-service:latest + tags: ghcr.io/survivalquestmc/attachment-service:latest diff --git a/Cargo.lock b/Cargo.lock index 5048b84..bdba70b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,6 +66,7 @@ dependencies = [ "tower-http 0.2.5", "tracing", "tracing-subscriber", + "url", "uuid", ] diff --git a/Cargo.toml b/Cargo.toml index e1cd68e..b5fb021 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ tower-http = { version = "0.2.5", features = ["fs", "trace"] } tracing = "0.1.34" tracing-subscriber = { version = "0.3.11", features = ["env-filter"] } uuid = { version = "0.8.2", features = ["v4"] } +url = "2.2.2" [build-dependencies] tonic-build = "0.7.0" diff --git a/src/grpc/attachments.rs b/src/grpc/attachments.rs index a62b478..4825464 100644 --- a/src/grpc/attachments.rs +++ b/src/grpc/attachments.rs @@ -4,6 +4,7 @@ use std::env; use tonic::{Request, Response, Status}; use tracing::*; use uuid::Uuid; +use url::Url; use crate::Files; pub use attachments_proto::attachments_server::AttachmentsServer; @@ -24,7 +25,14 @@ impl Attachments for ImplementedAttachmentsServer { info!("received create attachment request"); trace!("parsing url"); - let file_url = request.into_inner().url; + let mut file_url = request.into_inner().url; + + // Parse the URL and strip off the query parameters + if let Ok(mut parsed_url) = Url::parse(&file_url) { + parsed_url.set_query(None); + file_url = parsed_url.to_string(); + } + debug!("finished parsing url: {}", file_url); let ext = Files::get_extension(&file_url)?;