minio / console

Simple UI for MinIO Object Storage :abacus:
https://min.io/docs/minio/linux/index.html
GNU Affero General Public License v3.0
849 stars 278 forks source link

can't preview text/plain files without .txt extension #2021

Closed buptzhoutian closed 2 years ago

buptzhoutian commented 2 years ago

For example, one file named service.log was uploaded to MinIO, the Content-Type of this object is "text/plain".

This service.log file can't be previewed. However, the same file uploaded as service.log.txt can be previewed.

prakashsvmx commented 2 years ago

It depends on browsers too.

e.g .log Chrome can load .log files in an iframe for Preview Firefox Will not load.

.txt for .txt both browsers will display.

buptzhoutian commented 2 years ago

It depends on browsers too.

e.g .log Chrome can load .log files in an iframe for Preview Firefox Will not load.

.txt for .txt both browsers will display.

I have tried MinIO Console RELEASE.2022-05-19T18-20-59Z on Microsoft Edge and Chrome, neither one can preview .log file, the button is disabled. image

prakashsvmx commented 2 years ago

as per code the below are the supported extensions for preview. so for the button to be enabled, it should fall into one of it.

export const extensionPreview = (
  fileName: string
): "image" | "text" | "audio" | "video" | "none" => {
  const imageExtensions = [
    "jif",
    "jfif",
    "apng",
    "avif",
    "svg",
    "webp",
    "bmp",
    "ico",
    "jpg",
    "jpe",
    "jpeg",
    "gif",
    "png",
    "heic",
  ];
  const textExtensions = ["pdf", "txt", "json"];
  const audioExtensions = ["wav", "mp3", "alac", "aiff", "dsd", "pcm"];
  const videoExtensions = [
    "mp4",
    "avi",
    "mpg",
    "webm",
    "mov",
    "flv",
    "mkv",
    "wmv",
    "avchd",
    "mpeg-4",
  ];
dvaldivia commented 2 years ago

We stopping previewing text files for security reasons. The alternative is to generate a share link and paste it in another tab.