Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

remove unnecessary begin/resuce blocks

ulferts201b6f4898c0
diff --git a/app/workers/extract_fulltext_job.rb b/app/workers/extract_fulltext_job.rb
index cb985a0843a..36a2a842d3b 100644
--- a/app/workers/extract_fulltext_job.rb
+++ b/app/workers/extract_fulltext_job.rb
@@ -51,37 +51,33 @@ class ExtractFulltextJob < ApplicationJob
private
def init
- begin
- carrierwave_uploader = @attachment.file
- @file = carrierwave_uploader.local_file
- @filename = carrierwave_uploader.file.filename
+ carrierwave_uploader = @attachment.file
+ @file = carrierwave_uploader.local_file
+ @filename = carrierwave_uploader.file.filename
- if @attachment.readable?
- resolver = Plaintext::Resolver.new(@file, @attachment.content_type)
- @text = resolver.text
- end
- rescue StandardError => e
- Rails.logger.error(
- "Failed to extract plaintext from file #{@attachment&.id} (On domain #{Setting.host_name}): #{e}: #{e.message}"
- )
+ if @attachment.readable?
+ resolver = Plaintext::Resolver.new(@file, @attachment.content_type)
+ @text = resolver.text
end
+ rescue StandardError => e
+ Rails.logger.error(
+ "Failed to extract plaintext from file #{@attachment&.id} (On domain #{Setting.host_name}): #{e}: #{e.message}"
+ )
end
def update
- begin
- Attachment
- .where(id: @attachment_id)
- .update_all(['fulltext = ?, fulltext_tsv = to_tsvector(?, ?), file_tsv = to_tsvector(?, ?)',
- @text,
- @language,
- OpenProject::FullTextSearch.normalize_text(@text),
- @language,
- OpenProject::FullTextSearch.normalize_filename(@filename)])
- rescue StandardError => e
- Rails.logger.error(
- "Failed to update TSV values for attachment #{@attachment&.id} (On domain #{Setting.host_name}): #{e.message[0..499]}[...]"
- )
- end
+ Attachment
+ .where(id: @attachment_id)
+ .update_all(['fulltext = ?, fulltext_tsv = to_tsvector(?, ?), file_tsv = to_tsvector(?, ?)',
+ @text,
+ @language,
+ OpenProject::FullTextSearch.normalize_text(@text),
+ @language,
+ OpenProject::FullTextSearch.normalize_filename(@filename)])
+ rescue StandardError => e
+ Rails.logger.error(
+ "Failed to update TSV values for attachment #{@attachment&.id} (On domain #{Setting.host_name}): #{e.message[0..499]}[...]"
+ )
end
def find_attachment(id)