From 42cef709611d07c62b803c795b757fd62c978688 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sat, 15 Feb 2020 17:22:56 +0100 Subject: [PATCH] helpers: fix getBaseName() and getFileExt() for urls with query-strings Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e2b84f0259465be4253a735c1ea7b9bbe5917046 Author: vanhofen Date: 2020-02-15 (Sat, 15 Feb 2020) Origin message was: ------------------ - helpers: fix getBaseName() and getFileExt() for urls with query-strings --- src/system/helpers.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 8fe5a56fa..29ed1a221 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -606,7 +606,9 @@ std::string getPathName(std::string &path) std::string getBaseName(std::string &path) { - return _getBaseName(path, "/"); + std::string p = path; + p = _getPathName(p, "?"); + return _getBaseName(p, "/"); } std::string getFileName(std::string &file) @@ -616,7 +618,9 @@ std::string getFileName(std::string &file) std::string getFileExt(std::string &file) { - return _getBaseName(file, "."); + std::string f = file; + f = _getPathName(f, "?"); + return _getBaseName(f, "."); }