billthefarmer / editor

Android simple text editor
https://billthefarmer.github.io/editor
GNU General Public License v3.0
474 stars 85 forks source link

Svg support #188

Closed IceflowRE closed 1 year ago

IceflowRE commented 1 year ago

Could you add support for svg files (.svg and derivates)?


Also why is there a file restriction in first place? Just let the user select any file and try to open it? In worst case some unreadable will displayed.

billthefarmer commented 1 year ago

Android uses mime types to determine file types rather than extensions. I will investigate.

It's a text editor. It uses the java BufferedReader class to read files a line at a time which assumes the file contains newline characters. and edits it using an android text editor view. Reading any sort of file is a good way to give the user a tool to corrupt images etc, or crash the app.

IceflowRE commented 1 year ago

Reading any sort of file is a good way to give the user a tool to corrupt images etc, or crash the app.

You could hide this behaviour behind an opt in option.

billthefarmer commented 1 year ago

This app already has too many options. The built in file picker will accept any file which is not (according to the mime type) an image, video or audio file. It does allow application files because JavaScript, markdown and other text files can be labelled as application/whatever.

billthefarmer commented 1 year ago

OK, I have added .svg files to the file picker and the intent filters. It's not possible to request more than one file mime type when using the android file picker via the Storage button. However when selecting a file in another app, like a file manager, it it possible to indicate that the app can handle several mime types.