Skip to content

Commit 744ded6

Browse files
authored
Restore rename (#364)
2 parents 3647620 + 7f543e9 commit 744ded6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

app/controllers/uploads_controller.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,16 @@ def document_params
3131
params.require(:documents).map do |document|
3232
{
3333
io: document,
34-
filename: document.original_filename,
34+
filename: derived_filename(document),
3535
content_type: document.content_type,
3636
}
3737
end
3838
end
39+
40+
def derived_filename(document)
41+
[
42+
"rename",
43+
document.original_filename,
44+
].join("_")
45+
end
3946
end

app/models/topic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def custom_file_name(document)
6363
provider.file_name_prefix.present? ? provider.file_name_prefix.parameterize : provider.name.parameterize(separator: "_"),
6464
published_at_year,
6565
published_at_month,
66-
document.filename.base.parameterize(separator: "_"),
66+
document.filename.base.sub("rename_", "").parameterize(separator: "_"),
6767
].compact.join("_") + "." + document.filename.extension
6868
end
6969

0 commit comments

Comments
 (0)