-
-
Notifications
You must be signed in to change notification settings - Fork 5
Safe mode
Obsidian in cooperation with the UNITADE plugin is capable of damaging some types of files or having problems working with the file system, and is quite famous for this. There are at least the following public issues:
And many other problems with parsing binary files, which at least MAY be (not equal
to "means") related to how Obsidian works with files; In short, the entire Obsidian
editor is a markdown processor (handler), its entire pipeline is tied to the .md
extension files, so the "extensions as markdown" function can damage files,
because Obsidian "converts" any other file to its format.
With the release of version "v3.*", when the plugin began to implement its own
editor based on Monaco technology (while the Obsidian processor is written on
CodeMirrors), this problem became avoidable, because codeview^21 allows editing
such binary files without systematically damaging them.
But, in order to avoid potential damage to important files, at least because there are mechanisms like OLR^14/OLUR^15, a "safe mode" was integrated, which does not allow a certain registry of files to be read as Markdown until it is brute-forced (commands) or disabled.
Safe mode does not prevent you from entering an extension in the settings, it does not allow the plugin itself to read the extension during their registration and processing. In the code, it looks something like this (the real code base may differ):
private __applyCfg(extensions: string, view: string): void {
this.settings.errors = {};
if (this.settings.debug_mode)
console.info(this.app.viewRegistry.typeByExtension);
const extensions_arr: string[] = extensions.split('>').map(s => s.trim());
for (const extension of extensions_arr) {
if (this.settings.safe_mode && view === 'markdown' && CONSTANTS.unsafeExtensions.contains(extension.toLowerCase())) {
if (this.settings.debug_mode)
console.debug('[UNITADE]: Skipped unsafe extension:', extension);
continue;
}
//...
}
//...
}The process of registering extensions itself occurs through the following functions-procedures:
apply() → __apply() → __applyCfg() → __tryApply() and implies its integration into
the configuration application functions.
- to find out which extensions are not supported by safe mode (skippable), look
at the following context:
"Safe-mode matrix"/"Global matrix of extensions"
UNITADE allows Obsidian to work with literally all possible file extensions, but this is not always good. The main problem is the fact that Obsidian "does not like" third-party extensions, and even more so it does not like "non-text format" extensions, i.e. binary or executable extensions, etc., when it tries to open them, it often damages their metadata or even completely damages the file.
Important
Safe mode only works with "markdown" file representations, i.e. you can also safely edit files as code (codeview) regardless of safe mode.
Safe mode checks the received extension for the presence of it in the registry of "unsafe" (binary) file extensions regardless of the case, you can see the extension matrix at this link: