feat: improve ArtCraft integration and configurable file opening
This commit is contained in:
1 parent
3bc62d2b69
commit
80bc2c458d
60 files changed
+1738
-232
No files matched your search
@@ -0,0 +1,20 @@
|
||||
package users
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestAutoOpenPreferences(t *testing.T) {
|
||||
valid, ok := normalizeAutoOpen(map[string]string{".JPG": "photocraft", ".txt": "preview", ".mp3": "download"})
|
||||
if !ok || valid[".jpg"] != "photocraft" {
|
||||
t.Fatal("valid mappings rejected")
|
||||
}
|
||||
for _, values := range []map[string]string{
|
||||
{"jpg": "photocraft"}, {"../secret": "download"}, {".jpg": "https://example.com"}, {".mp3": "soundcraft"}, {".jpg": "wordcraft"},
|
||||
} {
|
||||
if _, ok := normalizeAutoOpen(values); ok {
|
||||
t.Fatalf("invalid mapping accepted: %v", values)
|
||||
}
|
||||
}
|
||||
if _, ok := normalizeAutoOpen(nil); !ok {
|
||||
t.Fatal("legacy users must retain default opening behavior")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user