chore: normalize URL paths in appflowy collab server

This commit is contained in:
Bartosz Sypytkowski 2024-06-12 06:21:56 +02:00
parent 8a0c098fe8
commit 3721d209f2
2 changed files with 3 additions and 1 deletions

View File

@ -20,7 +20,7 @@ impl Client {
("preview_size", &preview_size.to_string()),
])
.map_err(|err| AppResponseError::new(ErrorCode::InvalidRequest, err.to_string()))?;
let url = format!("{}/api/search/{workspace_id}/?{query}", self.base_url);
let url = format!("{}/api/search/{workspace_id}?{query}", self.base_url);
let resp = self
.http_client_with_auth(Method::GET, &url)
.await?

View File

@ -23,6 +23,7 @@ use actix_identity::IdentityMiddleware;
use actix_session::storage::RedisSessionStore;
use actix_session::SessionMiddleware;
use actix_web::cookie::Key;
use actix_web::middleware::NormalizePath;
use actix_web::{dev::Server, web, web::Data, App, HttpServer};
use anyhow::{Context, Error};
use appflowy_ai_client::client::AppFlowyAIClient;
@ -128,6 +129,7 @@ pub async fn run_actix_server(
let realtime_server_actor = Supervisor::start(|_| RealtimeServerActor(realtime_server));
let mut server = HttpServer::new(move || {
App::new()
.wrap(NormalizePath::trim())
// Middleware is registered for each App, scope, or Resource and executed in opposite order as registration
.wrap(MetricsMiddleware)
.wrap(IdentityMiddleware::default())