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

Fix: On direct upload the file name could be empty

Wieland Lindenthal1cebc5d282a4
diff --git a/modules/bim/app/views/bim/ifc_models/ifc_models/_form.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/_form.html.erb
index c853c559027..967b8827daf 100644
--- a/modules/bim/app/views/bim/ifc_models/ifc_models/_form.html.erb
+++ b/modules/bim/app/views/bim/ifc_models/ifc_models/_form.html.erb
@@ -59,7 +59,13 @@ See doc/COPYRIGHT.rdoc for more details.
<%= nonced_javascript_tag do %>
jQuery(document).ready(function() {
var setDirectUploadFileName = function () {
- var fileName = jQuery('input[type=file]')[0].files[0].name;
+
+ var fileNameField = jQuery('input[type=file]')
+ var fileName = '';
+ if (fileNameField.length > 0) {
+ fileName = fileNameField[0].files[0].name;
+ }
+
var titleField = jQuery("#bim_ifc_models_ifc_model_title");
<%# When creating a new model, there is no titleField. %>