fix incorrect path and cut a new release #21
6 changed files with 31 additions and 13 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -1204,7 +1204,7 @@ checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
|||
|
||||
[[package]]
|
||||
name = "jobboerse"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
dependencies = [
|
||||
"actix-files",
|
||||
"actix-multipart",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "jobboerse"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
edition = "2021"
|
||||
rust-version = "1.58"
|
||||
repository = "https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/Jobboerse"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.1.4] (2022-05-25)
|
||||
|
||||
### Fix
|
||||
- replace incorrectly hardcoded path by config value
|
||||
|
||||
## [0.1.3] (2022-05-25)
|
||||
|
||||
### Add
|
||||
|
|
@ -52,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Overview Page of Dependency licenses
|
||||
|
||||
[Unreleased]: https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/Jobboerse/src/main
|
||||
[0.1.4]: https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/Jobboerse/src/version-0.1.4
|
||||
[0.1.3]: https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/Jobboerse/src/version-0.1.3
|
||||
[0.1.2]: https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/Jobboerse/src/version-0.1.2
|
||||
[0.1.1]: https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/Jobboerse/src/version-0.1.1
|
||||
|
|
|
|||
2
dist/arch/PKGBUILD
vendored
2
dist/arch/PKGBUILD
vendored
|
|
@ -9,7 +9,7 @@ _reponame=Jobboerse
|
|||
_pkgname="${_reponame,,}"
|
||||
_features=()
|
||||
pkgname="${_reponame,,}"
|
||||
pkgver=0.1.3
|
||||
pkgver=0.1.4
|
||||
pkgrel=1
|
||||
pkgdesc="FS-InfMath Job-Offer Page"
|
||||
arch=('x86_64') # Other architectures may work
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use futures_util::StreamExt;
|
|||
use handlebars::Handlebars;
|
||||
use lettre::message::{Mailbox, SinglePart};
|
||||
use lettre::{Address, AsyncTransport};
|
||||
use log::{debug, warn};
|
||||
use log::{debug, error, warn};
|
||||
use rand::distributions::DistString;
|
||||
use serde_json::json;
|
||||
use tempfile::NamedTempFile;
|
||||
|
|
@ -87,7 +87,7 @@ pub(crate) async fn create_joboffer_post(
|
|||
debug!("got lease, starting to process submission");
|
||||
|
||||
let job_offer_form =
|
||||
match JobOfferSubmitForm::from_multipart_form(multipart, user.as_ref()).await {
|
||||
match JobOfferSubmitForm::from_multipart_form(multipart, user.as_ref(), &config).await {
|
||||
Ok(form) => form,
|
||||
Err(err) => {
|
||||
if let Some(lease) = submission_lease {
|
||||
|
|
@ -261,6 +261,7 @@ impl JobOfferSubmitForm {
|
|||
async fn from_multipart_form(
|
||||
mut multipart: Multipart,
|
||||
user: Option<&User>,
|
||||
config: &ServerConfig,
|
||||
) -> Result<Self, MultipartFieldError> {
|
||||
let mut title = None;
|
||||
let mut offering_party = None;
|
||||
|
|
@ -349,14 +350,20 @@ impl JobOfferSubmitForm {
|
|||
.await?
|
||||
}
|
||||
ATTACHMENT_FILES => {
|
||||
multi_file(
|
||||
let result = multi_file(
|
||||
field,
|
||||
ATTACHMENT_FILES,
|
||||
&mut attachment_datas,
|
||||
upload_size_limit,
|
||||
upload_count_limit,
|
||||
config,
|
||||
)
|
||||
.await?
|
||||
.await;
|
||||
|
||||
if let Err(err) = result {
|
||||
error!("Failed to process file upload {:?}", err);
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
LINK_TITLES => {
|
||||
multi_field(field, LINK_TITLES, &mut link_titles, 128, Some(20)).await?
|
||||
|
|
@ -399,6 +406,7 @@ impl JobOfferSubmitForm {
|
|||
.collect();
|
||||
|
||||
assert_eq!(link_titles.len(), link_urls.len());
|
||||
|
||||
let links = link_titles
|
||||
.into_iter()
|
||||
.zip(link_urls.into_iter())
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use futures_util::StreamExt;
|
|||
use tempfile::NamedTempFile;
|
||||
|
||||
use crate::error::MultipartFieldError;
|
||||
use crate::ServerConfig;
|
||||
|
||||
pub async fn once_field(
|
||||
field: Field,
|
||||
|
|
@ -45,11 +46,12 @@ pub async fn multi_field(
|
|||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub async fn once_file(
|
||||
pub(crate) async fn once_file(
|
||||
field: Field,
|
||||
name: &'static str,
|
||||
storage: &mut Option<(String, Option<NamedTempFile>)>,
|
||||
max_size: usize,
|
||||
config: &ServerConfig,
|
||||
) -> Result<(), MultipartFieldError> {
|
||||
if storage.is_some() {
|
||||
Err(MultipartFieldError::TooManyOccurrences {
|
||||
|
|
@ -57,18 +59,19 @@ pub async fn once_file(
|
|||
limit: 1,
|
||||
})
|
||||
} else {
|
||||
let value = tmpfile_from_field(field, name, max_size).await?;
|
||||
let value = tmpfile_from_field(field, name, max_size, config).await?;
|
||||
*storage = Some(value);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn multi_file(
|
||||
pub(crate) async fn multi_file(
|
||||
field: Field,
|
||||
name: &'static str,
|
||||
storage: &mut Vec<(String, Option<NamedTempFile>)>,
|
||||
max_size: usize,
|
||||
max_count: Option<u8>,
|
||||
config: &ServerConfig,
|
||||
) -> Result<(), MultipartFieldError> {
|
||||
if let Some(count) = max_count {
|
||||
if storage.len() >= count.into() {
|
||||
|
|
@ -78,15 +81,16 @@ pub async fn multi_file(
|
|||
});
|
||||
}
|
||||
}
|
||||
let value = tmpfile_from_field(field, name, max_size).await?;
|
||||
let value = tmpfile_from_field(field, name, max_size, config).await?;
|
||||
storage.push(value);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn tmpfile_from_field(
|
||||
pub(crate) async fn tmpfile_from_field(
|
||||
mut field: Field,
|
||||
field_name: &'static str,
|
||||
limit: usize,
|
||||
config: &ServerConfig,
|
||||
) -> Result<(String, Option<NamedTempFile>), MultipartFieldError> {
|
||||
let file_name = field
|
||||
.content_disposition()
|
||||
|
|
@ -106,7 +110,7 @@ pub async fn tmpfile_from_field(
|
|||
let buf = if let Some(buf) = file_buffer.as_mut() {
|
||||
buf
|
||||
} else {
|
||||
let file = NamedTempFile::new_in("job_offers")?;
|
||||
let file = NamedTempFile::new_in(&config.config.data_storage_path)?;
|
||||
file_buffer.insert(BufWriter::new(file))
|
||||
};
|
||||
remaining -= data.len();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue