From 1cf7cec33465c2de0fd6039a18731a7dddc81172 Mon Sep 17 00:00:00 2001 From: Arnaud J Le Hors Date: Thu, 14 Nov 2024 14:47:28 +0100 Subject: [PATCH] Fix handling of url during import of model file Signed-off-by: Arnaud J Le Hors --- web/modules/mof/src/ModelUpdater.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/web/modules/mof/src/ModelUpdater.php b/web/modules/mof/src/ModelUpdater.php index f0fa3a0..92ee121 100644 --- a/web/modules/mof/src/ModelUpdater.php +++ b/web/modules/mof/src/ModelUpdater.php @@ -78,6 +78,18 @@ public function update(ModelInterface $model, array $model_data): int { else if ($field === 'date') { $model->set('changed', strtotime($value)); } + else if ($field === 'github') { + $parsed = parse_url($value); + if (isset($parsed['path'])) { + $model->set('github', ltrim($parsed['path'], '/')); + } + } + else if ($field === 'huggingface') { + $parsed = parse_url($value); + if (isset($parsed['path'])) { + $model->set('huggingface', ltrim($parsed['path'], '/')); + } + } else { $model->set($field, $value); }