serve static assets on urls with file extension #538
2 changed files with 8 additions and 8 deletions
|
@ -19,10 +19,10 @@ var AssetPreview = function AssetPreview(_ref) {
|
|||
fileExt = _ref$claimData.fileExt,
|
||||
contentType = _ref$claimData.contentType,
|
||||
thumbnail = _ref$claimData.thumbnail;
|
||||
var directSourceLink = "asset/".concat(name, "/").concat(claimId);
|
||||
var showUrlLink = "/".concat(claimId, "/").concat(name);
|
||||
var embedUrl = "/".concat(claimId, "/").concat(name, ".").concat(fileExt);
|
||||
var showUrl = "/".concat(claimId, "/").concat(name);
|
||||
return _react.default.createElement(_reactRouterDom.Link, {
|
||||
to: showUrlLink
|
||||
to: showUrl
|
||||
}, function () {
|
||||
switch (contentType) {
|
||||
case 'image/jpeg':
|
||||
|
@ -31,7 +31,7 @@ var AssetPreview = function AssetPreview(_ref) {
|
|||
case 'image/gif':
|
||||
return _react.default.createElement("img", {
|
||||
className: 'asset-preview-image',
|
||||
src: directSourceLink,
|
||||
src: embedUrl,
|
||||
alt: name
|
||||
});
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ import React from 'react';
|
|||
import { Link } from 'react-router-dom';
|
||||
|
||||
const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, contentType, thumbnail } }) => {
|
||||
const directSourceLink = `asset/${name}/${claimId}`;
|
||||
const showUrlLink = `/${claimId}/${name}`;
|
||||
const embedUrl = `/${claimId}/${name}.${fileExt}`;
|
||||
const showUrl = `/${claimId}/${name}`;
|
||||
return (
|
||||
<Link to={showUrlLink} >
|
||||
<Link to={showUrl} >
|
||||
{(() => {
|
||||
switch (contentType) {
|
||||
case 'image/jpeg':
|
||||
|
@ -15,7 +15,7 @@ const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, c
|
|||
return (
|
||||
<img
|
||||
className={'asset-preview-image'}
|
||||
src={directSourceLink}
|
||||
src={embedUrl}
|
||||
alt={name}
|
||||
/>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue