Closed DaviDeMeo closed 2 years ago
This code get called immediately when the page redirect to the newly created pasta and the check at line 394 will always be true for pasta with expiration of "never" https://github.com/szabodanika/microbin/blob/9e4940eb449e2f0d9da54ea37719d12e611a0ff4/src/main.rs#L392-L402
this should fix it and do one less comparison
pastas.retain(|p| { // expiration is `never` or not reached if p.expiration == 0 || p.expiration > timenow { // keep true } else { // remove the file itself fs::remove_file(format!("./pasta_data/{}/{}", p.id_as_animals(), p.file)); // and remove the containing directory fs::remove_dir(format!("./pasta_data/{}/", p.id_as_animals())); // remove false } });
It works fine for me with your change, can you give it a try? You can also deploy it on docker now B-).
Thanks for your help @DaviDeMeo, it is very appreciated!
This code get called immediately when the page redirect to the newly created pasta and the check at line 394 will always be true for pasta with expiration of "never" https://github.com/szabodanika/microbin/blob/9e4940eb449e2f0d9da54ea37719d12e611a0ff4/src/main.rs#L392-L402
this should fix it and do one less comparison