Merge pull request 'Update build image to Rust 1.51' (#8) from feature/update-to-1.51 into master
All checks were successful
Core Repos/ImageApi/pipeline/head This commit looks good

Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
2021-03-26 12:40:23 +00:00
3 changed files with 12 additions and 14 deletions

2
Jenkinsfile vendored
View File

@@ -1,7 +1,7 @@
pipeline {
agent {
docker {
image 'rust:1.48'
image 'rust:1.51'
args '-v "$PWD":/usr/src/image-api'
}
}

View File

@@ -144,9 +144,7 @@ pub mod testhelpers {
.user_map
.borrow()
.iter()
.filter(|u| u.username == user && u.password == pass)
.collect::<Vec<&User>>()
.first()
.find(|&u| u.username == user && u.password == pass)
{
Some(u) => {
let copy = (*u).clone();
@@ -160,9 +158,7 @@ pub mod testhelpers {
self.user_map
.borrow()
.iter()
.filter(|u| u.username == user)
.collect::<Vec<&User>>()
.first()
.find(|&u| u.username == user)
.is_some()
}
}

View File

@@ -234,10 +234,13 @@ async fn favorites(claims: Claims) -> impl Responder {
async fn post_add_favorite(claims: Claims, body: web::Json<AddFavoriteRequest>) -> impl Responder {
if let Ok(user_id) = claims.sub.parse::<i32>() {
let path = body.path.clone();
web::block::<_, _, String>(move || Ok(add_favorite(user_id, path)))
web::block::<_, _, String>(move || {
add_favorite(user_id, path);
Ok(())
})
.await
.unwrap();
debug!("Adding favorite \"{}\" for userid: {}", user_id, body.path);
debug!("Adding favorite \"{}\" for userid: {}", body.path, user_id);
HttpResponse::Ok()
} else {
error!("Unable to parse sub as i32: {}", claims.sub);
@@ -330,9 +333,8 @@ fn main() -> std::io::Result<()> {
DebouncedEvent::Rename(orig, _) | DebouncedEvent::Write(orig) => {
let image_base_path = PathBuf::from(env::var("BASE_PATH").unwrap());
let image_relative = orig.strip_prefix(&image_base_path).unwrap();
if let Ok(old_thumbnail) = env::var("THUMBNAILS")
.map(|base| PathBuf::from(base))
.map(|mut base| {
if let Ok(old_thumbnail) =
env::var("THUMBNAILS").map(PathBuf::from).map(|mut base| {
base.push(image_relative);
base
})