Explorar o código

refactor: better way to check page file type

charlie %!s(int64=3) %!d(string=hai) anos
pai
achega
b1b8405217
Modificáronse 1 ficheiros con 1 adicións e 2 borrados
  1. 1 2
      src/main/frontend/fs.cljs

+ 1 - 2
src/main/frontend/fs.cljs

@@ -74,8 +74,7 @@
   [repo dir path content opts]
   (when content
     (let [fs-record (get-fs dir)]
-      (p/let [md-or-org? (or (string/ends-with? path ".md")
-                             (string/ends-with? path ".org"))
+      (p/let [md-or-org? (contains? #{"md" "markdown" "org"} (util/get-file-ext path))
               content (if-not md-or-org? content (encrypt/encrypt content))]
         (->
          (p/let [_ (protocol/write-file! (get-fs dir) repo dir path content opts)]