Skip to content

Commit f5727ed

Browse files
committed
fix: stale pattern n.path after colon-encoding
1 parent 4fe2438 commit f5727ed

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/detail/pattern.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ apply(
288288
dest0++;
289289
}
290290
}
291+
n.path += diff;
291292
}
292293
}
293294
// 2) url has no authority and path

test/unit/format.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,17 @@ struct format_test
943943
}
944944
}
945945

946+
void
947+
testColonInFirstSegment()
948+
{
949+
// first segment with colon triggers encoding;
950+
// n.path must be updated after colon-encoding
951+
{
952+
url u = urls::format("{}", "a:b");
953+
BOOST_TEST_CSTR_EQ(u.encoded_path(), "a%3Ab");
954+
}
955+
}
956+
946957
void
947958
run()
948959
{
@@ -953,6 +964,7 @@ struct format_test
953964
testFormat();
954965
testLLONGMIN();
955966
testCenterAlignPad();
967+
testColonInFirstSegment();
956968
#endif
957969
}
958970
};

0 commit comments

Comments
 (0)