Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9311980
D7757.id28125.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D7757.id28125.diff
View Options
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 %}
<i>File is empty</i>
- {% elif filename and filename|default:""|slice:"-5:" == "ipynb" %}
- <div class="swh-ipynb">
- </div>
- {% elif "text/" in mimetype or "application/" in mimetype and encoding != "binary" %}
- <div class="highlightjs">
- <pre><code class="{{ language }}">{{ content }}</code></pre>
- </div>
{% elif mimetype in browsers_supported_image_mimes and content %}
<img src="data:{{ mimetype }};base64,{{ content }}"/>
{% elif "application/pdf" == mimetype %}
@@ -43,6 +36,13 @@
</div>
<canvas id="pdf-canvas"></canvas>
</div>
+ {% elif filename and filename|default:""|slice:"-5:" == "ipynb" %}
+ <div class="swh-ipynb">
+ </div>
+ {% elif "text/" in mimetype or "application/" in mimetype and encoding != "binary" %}
+ <div class="highlightjs">
+ <pre><code class="{{ language }}">{{ content }}</code></pre>
+ </div>
{% elif content %}
Content with mime type {{ mimetype }} and encoding {{ encoding }} cannot be displayed.
{% else %}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 2, 10:38 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3216856
Attached To
D7757: templates/content-display: Check content rendering for mime type first
Event Timeline
Log In to Comment