From d558776cd3b7651e989c552554be03f608b159e3 Mon Sep 17 00:00:00 2001 From: Leandro Doctors Date: Fri, 25 Oct 2024 16:11:15 +0200 Subject: [PATCH 1/2] Fix Response Status Code for Failing XML Emits In case that the generation of XML for responses failed, an OperationOutcome was already produced - but the status code was kept at 200. This was incorrect: in such a case that the server is unable to generate the XML output, the status code should be changed to 500. --- .../src/blaze/middleware/fhir/output.clj | 20 +++++++++++++------ .../blaze/middleware/fhir/output_test.clj | 2 ++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/rest-util/src/blaze/middleware/fhir/output.clj b/modules/rest-util/src/blaze/middleware/fhir/output.clj index 4d5217b10..ae45c8fd7 100644 --- a/modules/rest-util/src/blaze/middleware/fhir/output.clj +++ b/modules/rest-util/src/blaze/middleware/fhir/output.clj @@ -38,23 +38,31 @@ (xml/emit (fhir-spec/unform-xml body) writer)) (.toByteArray out))) -(defn- generate-xml* [body] +(defn- generate-xml-error [e] + (-> e + ba/anomaly + handler-util/operation-outcome + generate-xml**)) + +(defn- generate-xml* [response] (try - (generate-xml** body) + (update response :body generate-xml**) (catch Throwable e - (generate-xml** (handler-util/operation-outcome (ba/anomaly e)))))) + (assoc response + :body (generate-xml-error e) + :status 500)))) -(defn- generate-xml [body] +(defn- generate-xml [response] (log/trace "generate XML") (with-open [_ (prom/timer generate-duration-seconds "xml")] - (generate-xml* body))) + (generate-xml* response))) (defn- encode-response-json [{:keys [body] :as response} content-type] (cond-> response body (-> (update :body generate-json) (ring/content-type content-type)))) (defn- encode-response-xml [{:keys [body] :as response} content-type] - (cond-> response body (-> (update :body generate-xml) + (cond-> response body (-> generate-xml (ring/content-type content-type)))) (defn- format-key [format] diff --git a/modules/rest-util/test/blaze/middleware/fhir/output_test.clj b/modules/rest-util/test/blaze/middleware/fhir/output_test.clj index beddb78c2..9405e0996 100644 --- a/modules/rest-util/test/blaze/middleware/fhir/output_test.clj +++ b/modules/rest-util/test/blaze/middleware/fhir/output_test.clj @@ -138,7 +138,9 @@ (testing "failing XML emit" (given (call (special-resource-handler {:fhir/type :fhir/Patient :id "0" :gender #fhir/code"foo\u001Ebar"}) {:headers {"accept" "application/fhir+xml"}}) + :status := 500 [:headers "Content-Type"] := "application/fhir+xml;charset=utf-8" + [:body parse-xml :fhir/type] := :fhir/OperationOutcome [:body parse-xml :issue 0 :diagnostics] := "Invalid white space character (0x1e) in text to output (in xml 1.1, could output as a character entity)"))) (deftest not-acceptable-test From 222858afd1a5541aac9aa4b3d18313c7ceca7225 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 12:18:04 +0000 Subject: [PATCH 2/2] chore(deps): update dependency tailwindcss to v3.4.15 --- modules/frontend/package-lock.json | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/modules/frontend/package-lock.json b/modules/frontend/package-lock.json index 73cfab954..13122af89 100644 --- a/modules/frontend/package-lock.json +++ b/modules/frontend/package-lock.json @@ -4672,33 +4672,33 @@ } }, "node_modules/tailwindcss": { - "version": "3.4.14", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.14.tgz", - "integrity": "sha512-IcSvOcTRcUtQQ7ILQL5quRDg7Xs93PdJEk1ZLbhhvJc7uj/OAhYOnruEiwnGgBvUtaUAJ8/mhSw1o8L2jCiENA==", + "version": "3.4.15", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.15.tgz", + "integrity": "sha512-r4MeXnfBmSOuKUWmXe6h2CcyfzJCEk4F0pptO5jlnYSIViUkVmsawj80N5h2lO3gwcmSb4n3PuN+e+GC1Guylw==", "license": "MIT", "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", - "chokidar": "^3.5.3", + "chokidar": "^3.6.0", "didyoumean": "^1.2.2", "dlv": "^1.1.3", - "fast-glob": "^3.3.0", + "fast-glob": "^3.3.2", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.21.0", + "jiti": "^1.21.6", "lilconfig": "^2.1.0", - "micromatch": "^4.0.5", + "micromatch": "^4.0.8", "normalize-path": "^3.0.0", "object-hash": "^3.0.0", - "picocolors": "^1.0.0", - "postcss": "^8.4.23", + "picocolors": "^1.1.1", + "postcss": "^8.4.47", "postcss-import": "^15.1.0", "postcss-js": "^4.0.1", - "postcss-load-config": "^4.0.1", - "postcss-nested": "^6.0.1", - "postcss-selector-parser": "^6.0.11", - "resolve": "^1.22.2", - "sucrase": "^3.32.0" + "postcss-load-config": "^4.0.2", + "postcss-nested": "^6.2.0", + "postcss-selector-parser": "^6.1.2", + "resolve": "^1.22.8", + "sucrase": "^3.35.0" }, "bin": { "tailwind": "lib/cli.js", @@ -4756,9 +4756,9 @@ } }, "node_modules/tailwindcss/node_modules/yaml": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.0.tgz", - "integrity": "sha512-a6ae//JvKDEra2kdi1qzCyrJW/WZCgFi8ydDV+eXExl95t+5R+ijnqHJbz9tmMh8FUjx3iv2fCQ4dclAQlO2UQ==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", + "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", "license": "ISC", "bin": { "yaml": "bin.mjs"