   {:pre [(db-common/conn? conn)]}
   (timbre/debugf "Updating label %s (%s) for org %s user %s" (:name updating-label) (:uuid updating-label) (:org-uuid updating-label) (-> updating-label :author :user-id))
   (when-let [original-label (get-label conn label-uuid)]
-    (let [updated-label (merge original-label (ignore-props updating-label))]
+    (let [updated-label (->> updating-label
+                             ignore-props
+                             clean-input
+                            (merge original-label))]
       (schema/validate common/Label updated-label)
       (db-common/update-resource conn table-name primary-key label-uuid updated-label))))
 

(ns oc.storage.resources.label
  (:require [oc.lib.schema :as lib-schema]
            [clojure.set :as clj-set]
            [taoensso.timbre :as timbre]
            [schema.core :as schema]
            [oc.storage.resources.common :as common]

(def table-name common/label-table-name)
(def primary-key :uuid)

(def reserved-slugs #{})

(def ignored-properties
  "Properties of a resource that are ignored during an update."
  common/reserved-properties)

(defn ignore-props
  "Remove any ignored properties from the org."
  [label]
  (apply dissoc label ignored-properties))

(defn clean-input [label]
  (as-> label l
    (if (:name l)
      (update l :name #(lib-html/strip-xss-tags (or % "")))
      l)))

;; Utilities

