Commit 40c8a68
committed
refactor(server): standardize URL path handling with normalizeURLPath
Replace manual path manipulation with a dedicated normalizeURLPath function
that properly handles path joining while ensuring consistent formatting.
The function:
- Always starts paths with a leading slash
- Never ends paths with a trailing slash (except for root path "/")
- Uses path.Join internally for proper path normalization
- Handles edge cases like empty segments, double slashes, and parent references
This eliminates duplicated code and creates a more consistent approach to
URL path handling throughout the SSE server implementation. Comprehensive
tests were added to validate the function's behavior.1 parent 1999773 commit 40c8a68
2 files changed
+129
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 113 | + | |
117 | 114 | | |
118 | 115 | | |
119 | 116 | | |
| |||
126 | 123 | | |
127 | 124 | | |
128 | 125 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 126 | + | |
133 | 127 | | |
134 | 128 | | |
135 | 129 | | |
| |||
388 | 382 | | |
389 | 383 | | |
390 | 384 | | |
391 | | - | |
| 385 | + | |
392 | 386 | | |
393 | 387 | | |
394 | 388 | | |
| |||
515 | 509 | | |
516 | 510 | | |
517 | 511 | | |
518 | | - | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
519 | 515 | | |
520 | 516 | | |
521 | 517 | | |
522 | 518 | | |
523 | 519 | | |
524 | | - | |
| 520 | + | |
525 | 521 | | |
526 | 522 | | |
527 | 523 | | |
528 | | - | |
| 524 | + | |
529 | 525 | | |
530 | 526 | | |
531 | 527 | | |
| |||
534 | 530 | | |
535 | 531 | | |
536 | 532 | | |
537 | | - | |
| 533 | + | |
| 534 | + | |
538 | 535 | | |
539 | 536 | | |
540 | 537 | | |
541 | 538 | | |
542 | 539 | | |
543 | | - | |
| 540 | + | |
544 | 541 | | |
545 | 542 | | |
546 | 543 | | |
547 | | - | |
| 544 | + | |
548 | 545 | | |
549 | 546 | | |
550 | 547 | | |
| |||
628 | 625 | | |
629 | 626 | | |
630 | 627 | | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1031 | 1031 | | |
1032 | 1032 | | |
1033 | 1033 | | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
1034 | 1132 | | |
1035 | 1133 | | |
1036 | 1134 | | |
| |||
0 commit comments