diff --git a/backend/src/app/rpc/commands/files_temp.clj b/backend/src/app/rpc/commands/files_temp.clj index 19ee187974..f1e603f566 100644 --- a/backend/src/app/rpc/commands/files_temp.clj +++ b/backend/src/app/rpc/commands/files_temp.clj @@ -118,7 +118,6 @@ (ex/raise :type :validation :code :cant-persist-already-persisted-file)) - (let [changes (->> (db/cursor conn (sql/select :file-change {:file-id id} {:order-by [[:revn :asc]]}) diff --git a/common/deps.edn b/common/deps.edn index d6438f7b5b..c96648ac39 100644 --- a/common/deps.edn +++ b/common/deps.edn @@ -76,7 +76,8 @@ :extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}} :shadow-cljs - {:main-opts ["-m" "shadow.cljs.devtools.cli"]} + {:main-opts ["-m" "shadow.cljs.devtools.cli"] + :jvm-opts ["--sun-misc-unsafe-memory-access=allow"]} :outdated {:extra-deps {com.github.liquidz/antq {:mvn/version "RELEASE"}} diff --git a/common/package.json b/common/package.json index 2560d6822d..46338a3356 100644 --- a/common/package.json +++ b/common/package.json @@ -11,8 +11,7 @@ "url": "https://github.com/penpot/penpot" }, "dependencies": { - "luxon": "^3.4.4", - "sax": "^1.4.1" + "luxon": "^3.4.4" }, "devDependencies": { "concurrently": "^9.0.1", diff --git a/common/src/app/common/svg.cljc b/common/src/app/common/svg.cljc index c542f2222f..a3b309b14f 100644 --- a/common/src/app/common/svg.cljc +++ b/common/src/app/common/svg.cljc @@ -6,8 +6,6 @@ (ns app.common.svg (:require - #?(:clj [clojure.xml :as xml] - :cljs [tubax.core :as tubax]) [app.common.data :as d] [app.common.data.macros :as dm] [app.common.geom.matrix :as gmt] @@ -15,15 +13,7 @@ [app.common.geom.shapes :as gsh] [app.common.math :as mth] [app.common.uuid :as uuid] - [cuerdas.core :as str]) - #?(:clj - (:import - clojure.lang.XMLHandler - java.io.InputStream - javax.xml.XMLConstants - javax.xml.parsers.SAXParserFactory - org.apache.commons.io.IOUtils))) - + [cuerdas.core :as str])) ;; Regex for XML ids per Spec ;; https://www.w3.org/TR/2008/REC-xml-20081126/#sec-common-syn @@ -1030,24 +1020,3 @@ :height (d/parse-integer (:height attrs) 0)})))] (reduce-nodes redfn [] svg-data))) -#?(:clj - (defn- secure-parser-factory - [^InputStream input ^XMLHandler handler] - (.. (doto (SAXParserFactory/newInstance) - (.setFeature XMLConstants/FEATURE_SECURE_PROCESSING true) - (.setFeature "http://apache.org/xml/features/disallow-doctype-decl" true)) - (newSAXParser) - (parse input handler)))) - -(defn strip-doctype - [data] - (cond-> data - (str/includes? data "]*>" ""))) - -(defn parse - [text] - #?(:cljs (tubax/xml->clj text) - :clj (let [text (strip-doctype text)] - (dm/with-open [istream (IOUtils/toInputStream text "UTF-8")] - (xml/parse istream secure-parser-factory))))) diff --git a/common/test/common_tests/files_builder_test.cljc b/common/test/common_tests/files_builder_test.cljc deleted file mode 100644 index d8a4d9dd69..0000000000 --- a/common/test/common_tests/files_builder_test.cljc +++ /dev/null @@ -1,26 +0,0 @@ -;; This Source Code Form is subject to the terms of the Mozilla Public -;; License, v. 2.0. If a copy of the MPL was not distributed with this -;; file, You can obtain one at http://mozilla.org/MPL/2.0/. -;; -;; Copyright (c) KALEIDOS INC - -(ns common-tests.files-builder-test - (:require - [app.common.files.builder :as builder] - [clojure.test :as t])) - -(t/deftest test-strip-image-extension - (t/testing "removes extension from supported image files" - (t/is (= (builder/strip-image-extension "foo.png") "foo")) - (t/is (= (builder/strip-image-extension "foo.webp") "foo")) - (t/is (= (builder/strip-image-extension "foo.jpg") "foo")) - (t/is (= (builder/strip-image-extension "foo.jpeg") "foo")) - (t/is (= (builder/strip-image-extension "foo.svg") "foo")) - (t/is (= (builder/strip-image-extension "foo.gif") "foo"))) - - (t/testing "does not remove extension for unsupported files" - (t/is (= (builder/strip-image-extension "foo.txt") "foo.txt")) - (t/is (= (builder/strip-image-extension "foo.bmp") "foo.bmp"))) - - (t/testing "leaves filename intact when it has no extension" - (t/is (= (builder/strip-image-extension "README") "README")))) diff --git a/common/test/common_tests/media_test.cljc b/common/test/common_tests/media_test.cljc new file mode 100644 index 0000000000..5098bf6e82 --- /dev/null +++ b/common/test/common_tests/media_test.cljc @@ -0,0 +1,26 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + +(ns common-tests.media-test + (:require + [app.common.media :as media] + [clojure.test :as t])) + +(t/deftest test-strip-image-extension + (t/testing "removes extension from supported image files" + (t/is (= (media/strip-image-extension "foo.png") "foo")) + (t/is (= (media/strip-image-extension "foo.webp") "foo")) + (t/is (= (media/strip-image-extension "foo.jpg") "foo")) + (t/is (= (media/strip-image-extension "foo.jpeg") "foo")) + (t/is (= (media/strip-image-extension "foo.svg") "foo")) + (t/is (= (media/strip-image-extension "foo.gif") "foo"))) + + (t/testing "does not remove extension for unsupported files" + (t/is (= (media/strip-image-extension "foo.txt") "foo.txt")) + (t/is (= (media/strip-image-extension "foo.bmp") "foo.bmp"))) + + (t/testing "leaves filename intact when it has no extension" + (t/is (= (media/strip-image-extension "README") "README")))) diff --git a/common/test/common_tests/runner.cljc b/common/test/common_tests/runner.cljc index 09c25061e2..287f6c42d4 100644 --- a/common/test/common_tests/runner.cljc +++ b/common/test/common_tests/runner.cljc @@ -9,7 +9,6 @@ [clojure.test :as t] [common-tests.colors-test] [common-tests.data-test] - [common-tests.files-builder-test] [common-tests.files-changes-test] [common-tests.files-migrations-test] [common-tests.geom-point-test] @@ -29,6 +28,7 @@ [common-tests.logic.swap-and-reset-test] [common-tests.logic.swap-as-override-test] [common-tests.logic.token-test] + [common-tests.media-test] [common-tests.pages-helpers-test] [common-tests.record-test] [common-tests.schema-test] @@ -58,7 +58,6 @@ (t/run-tests 'common-tests.colors-test 'common-tests.data-test - 'common-tests.files-builder-test 'common-tests.files-changes-test 'common-tests.files-migrations-test 'common-tests.geom-point-test @@ -78,6 +77,7 @@ 'common-tests.logic.swap-and-reset-test 'common-tests.logic.swap-as-override-test 'common-tests.logic.token-test + 'common-tests.media-test 'common-tests.pages-helpers-test 'common-tests.record-test 'common-tests.schema-test @@ -85,11 +85,11 @@ 'common-tests.svg-test 'common-tests.text-test 'common-tests.time-test - 'common-tests.types.modifiers-test - 'common-tests.types.shape-interactions-test - 'common-tests.types.shape-decode-encode-test - 'common-tests.types.tokens-lib-test - 'common-tests.types.components-test 'common-tests.types.absorb-assets-test + 'common-tests.types.components-test + 'common-tests.types.modifiers-test 'common-tests.types.path-data-test + 'common-tests.types.shape-decode-encode-test + 'common-tests.types.shape-interactions-test + 'common-tests.types.tokens-lib-test 'common-tests.uuid-test)) diff --git a/common/vendor/beicon/impl/rxjs.cljs b/common/vendor/beicon/impl/rxjs.cljs deleted file mode 100644 index 6fa0bcfa09..0000000000 --- a/common/vendor/beicon/impl/rxjs.cljs +++ /dev/null @@ -1,4 +0,0 @@ -(ns beicon.impl.rxjs - (:require ["rxjs" :as rx])) - -(goog/exportSymbol "rxjsMain" rx) diff --git a/common/vendor/beicon/impl/rxjs_operators.cljs b/common/vendor/beicon/impl/rxjs_operators.cljs deleted file mode 100644 index 22b4e2313d..0000000000 --- a/common/vendor/beicon/impl/rxjs_operators.cljs +++ /dev/null @@ -1,4 +0,0 @@ -(ns beicon.impl.rxjs-operators - (:require ["rxjs/operators" :as rxop])) - -(goog/exportSymbol "rxjsOperators" rxop) diff --git a/common/vendor/tubax/saxjs.cljs b/common/vendor/tubax/saxjs.cljs deleted file mode 100644 index 3dc98550bb..0000000000 --- a/common/vendor/tubax/saxjs.cljs +++ /dev/null @@ -1,4 +0,0 @@ -(ns tubax.saxjs - (:require ["sax" :as sax])) - -(goog/exportSymbol "sax" sax) diff --git a/common/yarn.lock b/common/yarn.lock index d130bd1377..d323d4bf94 100644 --- a/common/yarn.lock +++ b/common/yarn.lock @@ -260,7 +260,6 @@ __metadata: concurrently: "npm:^9.0.1" luxon: "npm:^3.4.4" nodemon: "npm:^3.1.7" - sax: "npm:^1.4.1" shadow-cljs: "npm:3.0.5" source-map-support: "npm:^0.5.21" ws: "npm:^8.17.0" @@ -981,13 +980,6 @@ __metadata: languageName: node linkType: hard -"sax@npm:^1.4.1": - version: 1.4.1 - resolution: "sax@npm:1.4.1" - checksum: 10c0/6bf86318a254c5d898ede6bd3ded15daf68ae08a5495a2739564eb265cd13bcc64a07ab466fb204f67ce472bb534eb8612dac587435515169593f4fffa11de7c - languageName: node - linkType: hard - "semver@npm:^7.3.5": version: 7.6.2 resolution: "semver@npm:7.6.2"