diff --git a/cypress/integration/content-rendering.spec.js b/cypress/integration/content-rendering.spec.js --- a/cypress/integration/content-rendering.spec.js +++ b/cypress/integration/content-rendering.spec.js @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019 The Software Heritage developers + * Copyright (C) 2019-2022 The Software Heritage developers * See the AUTHORS file at the top-level directory of this distribution * License: GNU Affero General Public License version 3, or any later version * See top-level LICENSE file for more information @@ -42,7 +42,7 @@ it(`should render image with extension ${ext}`, function() { cy.request(this.Urls.tests_content_other_extension(ext)).then(response => { const data = response.body; - cy.visit(`${this.Urls.browse_content(data.sha1)}?path=file.${ext}`); + cy.visit(`${this.Urls.browse_content(data.sha1)}`); cy.get('.swh-content img') .should('be.visible'); }); @@ -60,7 +60,7 @@ it(`should render a PDF file`, function() { cy.request(this.Urls.tests_content_other_extension('pdf')).then(response => { const data = response.body; - cy.visit(`${this.Urls.browse_content(data.sha1)}?path=file.pdf`); + cy.visit(`${this.Urls.browse_content(data.sha1)}`); cy.get('.swh-content canvas') .wait(2000) .then(canvas => { diff --git a/swh/web/templates/includes/content-display.html b/swh/web/templates/includes/content-display.html --- a/swh/web/templates/includes/content-display.html +++ b/swh/web/templates/includes/content-display.html @@ -1,5 +1,5 @@ {% comment %} -Copyright (C) 2017-2021 The Software Heritage developers +Copyright (C) 2017-2022 The Software Heritage developers See the AUTHORS file at the top-level directory of this distribution License: GNU Affero General Public License version 3, or any later version See top-level LICENSE file for more information @@ -25,13 +25,6 @@ Content is too large to be displayed (size is greater than {{ max_content_size|filesizeformat }}). {% elif "inode/x-empty" == mimetype %} File is empty - {% elif filename and filename|default:""|slice:"-5:" == "ipynb" %} -
-
- {% elif "text/" in mimetype or "application/" in mimetype and encoding != "binary" %} -
-
{{ content }}
-
{% elif mimetype in browsers_supported_image_mimes and content %} {% elif "application/pdf" == mimetype %} @@ -43,6 +36,13 @@ + {% elif filename and filename|default:""|slice:"-5:" == "ipynb" %} +
+
+ {% elif "text/" in mimetype or "application/" in mimetype and encoding != "binary" %} +
+
{{ content }}
+
{% elif content %} Content with mime type {{ mimetype }} and encoding {{ encoding }} cannot be displayed. {% else %}