Skip to content

Commit

Permalink
Merge pull request #2961 from manyfold3d/fix-file-extension-error
Browse files Browse the repository at this point in the history
Fix display error with missing file extensions
  • Loading branch information
Floppy authored Oct 16, 2024
2 parents b58a293 + e40e96d commit 437586e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/views/application/_object_preview.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% if renderable?(file.extension) %>
<div class="position-relative">
<canvas id="preview-file-<%= file.to_param %>" class="object-preview position-relative" tabindex="0" data-preview
data-preview-url="<%= model_model_file_path(model, file, file.extension.to_sym) %>"
data-preview-url="<%= model_model_file_path(model, file, file.extension&.to_sym) %>"
data-worker-url="<%= javascript_path "offscreen_renderer.js" %>"
data-format="<%= file.extension %>"
data-y-up="<%= file.y_up %>"
Expand Down
2 changes: 1 addition & 1 deletion app/views/model_files/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<%= render partial: "problem", collection: @file.problems.visible(problem_settings) %>
<%= card :secondary, t(".actions_heading") do %>
<%= link_to safe_join([icon("cloud-download", t("general.download")), t("general.download")], " "), model_model_file_path(@model, @file, @file.extension.to_sym, download: "true"), {class: "btn btn-secondary"} %>
<%= link_to safe_join([icon("cloud-download", t("general.download")), t("general.download")], " "), model_model_file_path(@model, @file, @file.extension&.to_sym, download: "true"), {class: "btn btn-secondary"} %>
<% if policy(@file).edit? && ["stl", "obj"].include?(@file.extension) %>
<%= link_to safe_join([icon("arrow-left-right", t(".convert")), t(".convert")], " "), model_model_files_path(@model, convert: {id: @file.to_param, to: "threemf"}), method: :post, class: "btn btn-warning" %>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/models/_file.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
q0,5 5,5
h10
" />
<text x="50%" y="80%" fill="black" dominant-baseline="middle" text-anchor="middle" style="font-size: 8px"><%= file.extension.upcase %></text>
<text x="50%" y="80%" fill="black" dominant-baseline="middle" text-anchor="middle" style="font-size: 8px"><%= file.extension&.upcase %></text>
</svg>
<% end %>
<% end %>
Expand All @@ -41,7 +41,7 @@
<div class="row">
<div class="col">
<%= link_to t(".open_button.text"), model_model_file_path(@model, file), {class: "btn btn-primary", "aria-label": translate(".open_button.label", name: file.name)} %>
<%= link_to icon("cloud-download", t("general.download")), model_model_file_path(@model, file, file.extension.to_sym, download: "true"), {class: "btn btn-outline-secondary"} %>
<%= link_to icon("cloud-download", t("general.download")), model_model_file_path(@model, file, file.extension&.to_sym, download: "true"), {class: "btn btn-outline-secondary"} %>
<% if policy(@model).edit? %>
<%= form_with model: @model, class: "d-inline" do |form| %>
<%= form.hidden_field :preview_file_id, value: file.id %>
Expand Down

0 comments on commit 437586e

Please sign in to comment.