fix: file path unavailable

When clicking play, the file does re-download now, so no need to do anything there. Improved click behavior when file is deleted - it now still opens the folder in case someone is interested.
This commit is contained in:
Thomas Zarebczan 2019-02-11 17:51:17 -05:00
parent 421bcaf388
commit ffb4bf46cc

View file

@ -64,9 +64,12 @@ class FileDetails extends PureComponent<Props> {
const mediaType = contentType || 'unknown';
let downloadPath =
fileInfo && fileInfo.download_path ? path.normalize(fileInfo.download_path) : null;
// We should check if the file exists, and then show a better message, wtih an option to redownload.
if (fileInfo && fileInfo.download_path === null)
downloadPath = 'File may have been deleted or moved.';
let downloadNote;
// If the path is blank, file is not avialable. Create path from name so the folder opens on click.
if (fileInfo && fileInfo.download_path === null) {
downloadPath = `${fileInfo.download_directory}/${fileInfo.file_name}`;
downloadNote = 'This file may have been moved or deleted';
}
return (
<Fragment>
@ -103,7 +106,7 @@ class FileDetails extends PureComponent<Props> {
<Button
button="link"
onClick={() => openFolder(downloadPath)}
label={downloadPath}
label={downloadNote || downloadPath}
/>
</div>
)}