Do not attempte to delete pdfs when they are disabled
@@ -7,6 +7,7 @@ use cio_api::{
get_configs_from_repo, sync_buildings, sync_certificates, sync_github_outside_collaborators, sync_groups,
sync_links, sync_resources, sync_users,
},
+ features::Features,
repos::NewRepo,
rfds::{is_image, NewRFD, RFD},
shorturls::{generate_shorturls_for_configs_links, generate_shorturls_for_repos, generate_shorturls_for_rfds},
@@ -804,6 +805,7 @@ pub async fn handle_rfd_push(
// If the title of the RFD changed, delete the old PDF file so it
// doesn't linger in GitHub and Google Drive.
if !old_rfd_pdf.is_empty() && old_rfd_pdf != rfd.get_pdf_filename() {
+ if Features::is_enabled("RFD_PDFS_IN_GITHUB") {
let pdf_path = format!("/pdfs/{}", old_rfd_pdf);
// First get the sha of the old pdf.
@@ -838,7 +840,9 @@ pub async fn handle_rfd_push(
rfd.get_pdf_filename()
));
}
+ }
+ if Features::is_enabled("RFD_PDFS_IN_GOOGLE_DRIVE") {
// Get the directory by the name.
let parent_id = drive.files().create_folder(&shared_drive.id, "", "rfds").await?;
@@ -853,6 +857,7 @@ pub async fn handle_rfd_push(
rfd.get_pdf_filename()
));
}
+ }
a(&format!(
"[SUCCESS]: RFD {} `push` operations completed",
