From 3693e1656c791a3bef5f4a982131ba38e26c9542 Mon Sep 17 00:00:00 2001
From: john-metabase <92878045+john-metabase@users.noreply.github.com>
Date: Thu, 15 Jun 2023 09:34:30 -0400
Subject: [PATCH] Filter import on YAML extension (#31477)

* Filter import on YAML extension

* sorts namespaces

---------

Co-authored-by: Luiz Arakaki <luiz.arakaki@metabase.com>
---
 .../backend/src/metabase_enterprise/serialization/v2/ingest.clj | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/enterprise/backend/src/metabase_enterprise/serialization/v2/ingest.clj b/enterprise/backend/src/metabase_enterprise/serialization/v2/ingest.clj
index 398ea8d1a49..cc20d36cee2 100644
--- a/enterprise/backend/src/metabase_enterprise/serialization/v2/ingest.clj
+++ b/enterprise/backend/src/metabase_enterprise/serialization/v2/ingest.clj
@@ -5,6 +5,7 @@
   See the detailed description of the (de)serialization processes in [[metabase.models.serialization.base]]."
   (:require
    [clojure.java.io :as io]
+   [clojure.string :as str]
    [metabase.models.serialization :as serdes]
    [metabase.util.date-2 :as u.date]
    [metabase.util.yaml :as yaml]
@@ -61,6 +62,7 @@
   ;; This returns a map {unlabeled-hierarchy [original-hierarchy File]}.
   (into {} (for [^File file (file-seq root-dir)
                  :when      (and (.isFile file)
+                                 (str/ends-with? (.getName file) ".yaml")
                                  (let [rel (.relativize (.toPath root-dir) (.toPath file))]
                                    (-> rel (.subpath 0 1) (.toString) legal-top-level-paths)))
                  ;; TODO: only load YAML once.
-- 
GitLab