mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 02:30:12 +02:00
Ensure support for wide-char filenames on Windows #4391
This commit is contained in:
parent
0b5f131df8
commit
7c7f960b60
@ -22,6 +22,9 @@ Requires libvips v8.16.1
|
||||
[#4387](https://github.com/lovell/sharp/pull/4387)
|
||||
[@Stephen-X](https://github.com/Stephen-X)
|
||||
|
||||
* Ensure support for wide-character filenames on Windows (regression in 0.34.0).
|
||||
[#4391](https://github.com/lovell/sharp/issues/4391)
|
||||
|
||||
### v0.34.1 - 7th April 2025
|
||||
|
||||
* TypeScript: Ensure new `autoOrient` property is optional.
|
||||
|
@ -1359,7 +1359,8 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
// Add file size to info
|
||||
if (baton->formatOut != "dz" || sharp::IsDzZip(baton->fileOut)) {
|
||||
try {
|
||||
uint32_t const size = static_cast<uint32_t>(std::filesystem::file_size(baton->fileOut));
|
||||
uint32_t const size = static_cast<uint32_t>(
|
||||
std::filesystem::file_size(std::filesystem::u8path(baton->fileOut)));
|
||||
info.Set("size", size);
|
||||
} catch (...) {}
|
||||
}
|
||||
|
@ -1036,4 +1036,21 @@ describe('Input/output', function () {
|
||||
});
|
||||
readable.pipe(inPipeline).pipe(badPipeline);
|
||||
});
|
||||
|
||||
it('supports wide-character filenames', async () => {
|
||||
const filename = fixtures.path('output.图片.jpg');
|
||||
const create = {
|
||||
width: 8,
|
||||
height: 8,
|
||||
channels: 3,
|
||||
background: 'green'
|
||||
};
|
||||
await sharp({ create }).toFile(filename);
|
||||
|
||||
const { width, height, channels, format } = await sharp(filename).metadata();
|
||||
assert.strictEqual(width, 8);
|
||||
assert.strictEqual(height, 8);
|
||||
assert.strictEqual(channels, 3);
|
||||
assert.strictEqual(format, 'jpeg');
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user