From 8052618fa8e087c513a57e044e39435428ba7c65 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Tue, 13 May 2025 11:28:44 +0200 Subject: [PATCH] Fix #1818: wrong argument order in clojure.java.io/resource (#1819) * Fix #1818: wrong argument order in clojure.java.io/resource * fix --- CHANGELOG.md | 1 + src/babashka/impl/classpath.clj | 4 ++-- src/babashka/main.clj | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d8248bc..f4b4d3e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ A preview of the next release can be installed from ## Unreleased +- [#1818](https://github.com/babashka/babashka/issues/1818): wrong argument order in `clojure.java.io/resource` implementation - Add `java.text.BreakIterator` - Bump `fs` to `0.5.25` - Bump `jsoup` to `1.20.1` diff --git a/src/babashka/impl/classpath.clj b/src/babashka/impl/classpath.clj index 6da8b59f..55597802 100644 --- a/src/babashka/impl/classpath.clj +++ b/src/babashka/impl/classpath.clj @@ -84,8 +84,8 @@ cp))) (defn resource - (^URL [path] (resource @the-url-loader path)) - (^URL [loader path] + (^URL [path] (resource path @the-url-loader)) + (^URL [path loader] (if (str/starts-with? path "/") nil ;; non-relative paths always return nil (getResource loader [path] true)))) diff --git a/src/babashka/main.clj b/src/babashka/main.clj index 773cc7fb..8c867774 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -1190,7 +1190,7 @@ Use bb run --help to show this help output. (println "[babashka] WARNING: config file does not exist:" config)) nil)) jar (let [jar (resolve-symbolic-link jar)] - (some-> [jar] cp/new-loader (cp/resource "META-INF/bb.edn") .toString)) + (some->> [jar] cp/new-loader (cp/resource "META-INF/bb.edn") .toString)) :else (if (and file (fs/exists? file)) ;; file relative to bb.edn (let [file (abs-path file) ;; follow symlink