This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit 70da8ee4 authored by Michael Kozono's avatar Michael Kozono
Browse files

Fix Rubocop offenses

parent 23cb43c8ec6a
......@@ -91,13 +91,13 @@ def insert_file_path(file_path)
table_columns_and_values = 'untracked_files_for_uploads (path, created_at, updated_at) VALUES (?, ?, ?)'
sql = if Gitlab::Database.postgresql?
"INSERT INTO #{table_columns_and_values} ON CONFLICT DO NOTHING;"
else
"INSERT IGNORE INTO #{table_columns_and_values};"
end
"INSERT INTO #{table_columns_and_values} ON CONFLICT DO NOTHING;"
else
"INSERT IGNORE INTO #{table_columns_and_values};"
end
timestamp = Time.now.utc.iso8601
sql = ActiveRecord::Base.send(:sanitize_sql_array, [sql, file_path, timestamp, timestamp])
sql = ActiveRecord::Base.send(:sanitize_sql_array, [sql, file_path, timestamp, timestamp]) # rubocop:disable GitlabSecurity/PublicSend
ActiveRecord::Base.connection.execute(sql)
end
......
......@@ -215,7 +215,6 @@ class Note < ActiveRecord::Base
context 'for a project Markdown attachment (notes, issues, MR descriptions) file path' do
let(:model) { create(:project) }
let(:expected_upload_attrs) { {} }
# UntrackedFile.path is different than Upload.path
let(:untracked_file) { create_untracked_file("/#{model.full_path}/#{model.uploads.first.path}") }
......@@ -228,7 +227,7 @@ class Note < ActiveRecord::Base
untracked_file
# Save the expected upload attributes
expected_upload_attrs = model.reload.uploads.first.attributes.slice('path', 'uploader', 'size', 'checksum')
@expected_upload_attrs = model.reload.uploads.first.attributes.slice('path', 'uploader', 'size', 'checksum')
# Untrack the file
model.reload.uploads.delete_all
......@@ -239,8 +238,7 @@ class Note < ActiveRecord::Base
untracked_file.add_to_uploads
end.to change { model.reload.uploads.count }.from(0).to(1)
hex_secret = untracked_file.path.match(/\/(\h+)\/rails_sample.jpg/)[1]
expect(model.uploads.first.attributes).to include(expected_upload_attrs)
expect(model.uploads.first.attributes).to include(@expected_upload_attrs)
end
end
end
......
......@@ -36,7 +36,7 @@
stub_application_setting(hashed_storage_enabled: true)
# Markdown upload after enabling hashed_storage
# Markdown upload after enabling hashed_storage
UploadService.new(project2, uploaded_file, FileUploader).execute
end
......
......@@ -42,7 +42,7 @@
it 'has a path field long enough for really long paths' do
migrate!
component = 'a'*255
component = 'a' * 255
long_path = [
'uploads',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment