From 19130fe48154385210e51e2892bd73f0fe654507 Mon Sep 17 00:00:00 2001 From: Dan Cojocaru Date: Sat, 17 Feb 2024 08:10:00 +0100 Subject: [PATCH] Properly escape query to allow space --- src/home.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/home.zig b/src/home.zig index a01fbfd..9a5ddc6 100644 --- a/src/home.zig +++ b/src/home.zig @@ -28,7 +28,9 @@ fn fetchThread(state: *AppState) !void { curl.reset(); - const query = try std.fmt.allocPrint(allocator, "query={s}&results=10&addresses=false&poi=false&pretty=false", .{station_name_buf.slice()}); + const station_name_escaped = try std.Uri.escapeQuery(allocator, station_name_buf.slice()); + defer allocator.free(station_name_escaped); + const query = try std.fmt.allocPrint(allocator, "query={s}&results=10&addresses=false&poi=false&pretty=false", .{station_name_escaped}); defer allocator.free(query); locations_uri.query = query; defer locations_uri.query = null;