serve static assets on urls with file extension #538

Merged
bones7242 merged 19 commits from 515-showlite-serves-asset into master 2018-07-20 18:57:12 +02:00
2 changed files with 8 additions and 8 deletions
Showing only changes of commit 004770587a - Show all commits

View file

@ -19,10 +19,10 @@ var AssetPreview = function AssetPreview(_ref) {
fileExt = _ref$claimData.fileExt, fileExt = _ref$claimData.fileExt,
contentType = _ref$claimData.contentType, contentType = _ref$claimData.contentType,
thumbnail = _ref$claimData.thumbnail; thumbnail = _ref$claimData.thumbnail;
var directSourceLink = "asset/".concat(name, "/").concat(claimId); var embedUrl = "/".concat(claimId, "/").concat(name, ".").concat(fileExt);
var showUrlLink = "/".concat(claimId, "/").concat(name); var showUrl = "/".concat(claimId, "/").concat(name);
return _react.default.createElement(_reactRouterDom.Link, { return _react.default.createElement(_reactRouterDom.Link, {
to: showUrlLink to: showUrl
}, function () { }, function () {
switch (contentType) { switch (contentType) {
case 'image/jpeg': case 'image/jpeg':
@ -31,7 +31,7 @@ var AssetPreview = function AssetPreview(_ref) {
case 'image/gif': case 'image/gif':
return _react.default.createElement("img", { return _react.default.createElement("img", {
className: 'asset-preview-image', className: 'asset-preview-image',
src: directSourceLink, src: embedUrl,
alt: name alt: name
}); });

View file

@ -2,10 +2,10 @@ import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, contentType, thumbnail } }) => { const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, contentType, thumbnail } }) => {
const directSourceLink = `asset/${name}/${claimId}`; const embedUrl = `/${claimId}/${name}.${fileExt}`;
const showUrlLink = `/${claimId}/${name}`; const showUrl = `/${claimId}/${name}`;
return ( return (
<Link to={showUrlLink} > <Link to={showUrl} >
{(() => { {(() => {
switch (contentType) { switch (contentType) {
case 'image/jpeg': case 'image/jpeg':
@ -15,7 +15,7 @@ const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, c
return ( return (
<img <img
className={'asset-preview-image'} className={'asset-preview-image'}
src={directSourceLink} src={embedUrl}
alt={name} alt={name}
/> />
); );