Move raw to /r/ instead of /

This commit is contained in:
Leonora Tindall 2022-01-31 21:54:00 -06:00 committed by Leonora Tindall
commit c3aa68af78
4 changed files with 5 additions and 5 deletions

View file

@ -48,7 +48,7 @@ pub async fn pretter_retrieve_inner(
Ok(v) => v,
Err(e) if e.kind() == InvalidData => {
return ResponseWrapper::redirect(Redirect::permanent(format!(
"/{}",
"/r/{}",
id
)));
}

View file

@ -7,13 +7,13 @@ use crate::models::paste_id::PasteId;
use crate::models::pretty_syntax::PasteIdSyntax;
use crate::models::response_wrapper::ResponseWrapper;
#[get("/<id>", rank = 2)]
#[get("/r/<id>", rank = 2)]
pub async fn retrieve(id: PasteId<'_>) -> ResponseWrapper<File> {
retrieve_inner(&id.to_string()).await
}
// rank 1 here because this would be more oftenly used
#[get("/<id_ext>", rank = 1)]
#[get("/r/<id_ext>", rank = 1)]
pub async fn retrieve_ext(id_ext: PasteIdSyntax<'_>) -> ResponseWrapper<File> {
retrieve_inner(id_ext.get_fname()).await
}

View file

@ -22,7 +22,7 @@ pub async fn upload(paste: Data<'_>) -> Result<String, std::io::Error> {
.contains("text")
{
true => format!("/p/{id}", id = id),
false => format!("/{id}", id = id),
false => format!("/r/{id}", id = id),
};
Ok(url)

View file

@ -12,7 +12,7 @@ NAME
bin - A highly opinionated and minamalistic Pastebin
ROUTES
GET /<id>
GET /r/<id>
Get raw pastes
GET /p/<id>
Get highlighted pastes