From 87aea59037191ca67ba5ea5c693732f861eab99c Mon Sep 17 00:00:00 2001 From: Pam Harris Date: Mon, 8 Jul 2024 14:26:02 -0600 Subject: [PATCH 1/2] Use regex to identify remote file url --- src/Util/File.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Util/File.cc b/src/Util/File.cc index 47ffc7833..c4388535a 100644 --- a/src/Util/File.cc +++ b/src/Util/File.cc @@ -8,6 +8,7 @@ #include #include +#include #include "String.h" @@ -35,7 +36,8 @@ bool IsCompressedFits(const std::string& filename) { } bool IsRemoteHttpFile(const std::string& filename) { - return filename.find("http") == 0; + const std::regex is_http_url("^https?://"); + return std::regex_search(filename, is_http_url); } bool IsGzMagicNumber(uint32_t magic_number) { From 2f8e3bad3ccf5b7e7ab3bf0c5d28937d8272ddc6 Mon Sep 17 00:00:00 2001 From: Pam Harris Date: Mon, 8 Jul 2024 14:27:23 -0600 Subject: [PATCH 2/2] Show traceback when error opening fits --- src/ImageData/CartaFitsImage.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ImageData/CartaFitsImage.cc b/src/ImageData/CartaFitsImage.cc index 64efac8d8..54a535ed8 100644 --- a/src/ImageData/CartaFitsImage.cc +++ b/src/ImageData/CartaFitsImage.cc @@ -240,6 +240,7 @@ fitsfile* CartaFitsImage::OpenFile() { fits_open_file(&fptr, _filename.c_str(), iomode, &status); if (status) { + fits_report_error(stdout, status); char err_text[30]; fits_get_errstatus(status, err_text); std::string error(err_text);