@@ -275,45 +275,24 @@ supabase_upload_survey <- function(survey_path, survey_name = NULL, conn = NULL,
275275 # Build relative path
276276 relative_path <- gsub(paste0(" ^" , survey_path , " /?" ), " " , file_path )
277277
278- # WHITELIST APPROACH: Only upload essential files
279- # Source files, final output, and assets - skip everything else
280- is_essential <- (
281- # Source files (what users edit)
282- grepl(" ^(survey\\ .qmd|app\\ .R|settings\\ .yml|head\\ .rds|README\\ .md)$" , relative_path ) ||
283- # Final rendered output and assets (preserve these)
284- grepl(" ^_survey/" , relative_path ) ||
285- grepl(" ^survey_files/" , relative_path )
286- )
287-
288- if (! is_essential ) {
289- next # Skip non-essential files (temp files, intermediate outputs, etc.)
290- }
291-
292- # Skip if file no longer exists (may happen during rendering)
293- if (! file.exists(file_path )) {
294- next
295- }
296-
297278 # Build storage path
298279 storage_path <- paste0(conn $ base_path , " /" , survey_name , " /" , relative_path )
299280
300281 # Upload file
301282 file_url <- build_storage_url(conn , storage_path )
302283
303- # Read file content (with additional check)
304- file_info <- file.info(file_path )
305- if (is.na(file_info $ size )) {
306- next # File disappeared between checks
307- }
308-
309- # Try to read file content (may fail if file deleted during rendering)
284+ # Try to read file content (silently skip if it fails)
310285 file_content <- tryCatch({
286+ file_info <- file.info(file_path )
287+ if (is.na(file_info $ size ) || ! file.exists(file_path )) {
288+ return (NULL )
289+ }
311290 readBin(file_path , " raw" , file_info $ size )
312291 }, error = function (e ) {
313- # File was deleted between list and read - skip it
314292 return (NULL )
315293 })
316294
295+ # Skip if we couldn't read the file
317296 if (is.null(file_content )) {
318297 next
319298 }
0 commit comments