From 9dc5d1a54068b2f1d01b1875a24cf58ef3e95c45 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Mon, 4 May 2009 17:45:29 -0300 Subject: [PATCH] ActionItem305: resist unexisting attachment --- script/import-cooperation.net | 4 ++++ 1 file changed, 4 insertions(+), 0 deletions(-) diff --git a/script/import-cooperation.net b/script/import-cooperation.net index 1667aaf..ebc0606 100755 --- a/script/import-cooperation.net +++ b/script/import-cooperation.net @@ -96,6 +96,10 @@ for username in ARGV Dir.glob(File.join(attachments_dir, 'attachments', '*.xml')).each do |attachment_xml| file = UploadedFile.new file.from_xml(File.read(attachment_xml)) + if !File.exist?(file.filesystem_location) + puts "W: skipping attachment pointing to unexisting file" + next + end puts "I: about to read data from #{file.filesystem_location} (xml: #{attachment_xml})" file.uploaded_data = FileData.new(file.filesystem_location, file.filename, file.content_type) file.parent = article -- libgit2 0.21.2