mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
terminal/kitty-gfx: ignore extra base64 padding
This commit is contained in:
@ -41,7 +41,11 @@ pub fn execute(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("executing kitty graphics command: {}", .{cmd.control});
|
log.debug("executing kitty graphics command: {}", .{cmd: {
|
||||||
|
var copy = cmd.*;
|
||||||
|
copy.data = "";
|
||||||
|
break :cmd copy;
|
||||||
|
}});
|
||||||
|
|
||||||
const resp_: ?Response = switch (cmd.control) {
|
const resp_: ?Response = switch (cmd.control) {
|
||||||
.query => query(alloc, cmd),
|
.query => query(alloc, cmd),
|
||||||
|
@ -241,9 +241,16 @@ pub const LoadingImage = struct {
|
|||||||
const start_i = self.data.items.len;
|
const start_i = self.data.items.len;
|
||||||
self.data.items.len = start_i + size;
|
self.data.items.len = start_i + size;
|
||||||
const buf = self.data.items[start_i..];
|
const buf = self.data.items[start_i..];
|
||||||
Base64Decoder.decode(buf, data) catch |err| {
|
Base64Decoder.decode(buf, data) catch |err| switch (err) {
|
||||||
|
// We have to ignore invalid padding because lots of encoders
|
||||||
|
// add the wrong padding. Since we validate image data later
|
||||||
|
// (PNG decode or simple dimensions check), we can ignore this.
|
||||||
|
error.InvalidPadding => {},
|
||||||
|
|
||||||
|
else => {
|
||||||
log.warn("failed to decode base64 data: {}", .{err});
|
log.warn("failed to decode base64 data: {}", .{err});
|
||||||
return error.InvalidData;
|
return error.InvalidData;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user