mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Improve error message for missing file that might be SVG
This commit is contained in:
@@ -398,6 +398,10 @@ namespace sharp {
|
||||
// From filesystem
|
||||
imageType = DetermineImageType(descriptor->file.data());
|
||||
if (imageType == ImageType::MISSING) {
|
||||
if (descriptor->file.find("<svg") != std::string::npos) {
|
||||
throw vips::VError("Input file is missing, did you mean "
|
||||
"sharp(Buffer.from('" + descriptor->file.substr(0, 8) + "...')?");
|
||||
}
|
||||
throw vips::VError("Input file is missing");
|
||||
}
|
||||
if (imageType != ImageType::UNKNOWN) {
|
||||
|
||||
Reference in New Issue
Block a user