@tmlmobilidade/fastify 20260625.1714.32 → 20260627.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -213,6 +213,22 @@ export class FastifyService {
213
213
  * Sets up hooks for the Fastify server including error handling and response processing.
214
214
  */
215
215
  _setupHooks() {
216
+ /**
217
+ * Decodes URI-encoded `id` path params so encoded slashes (e.g. `%2F`) are
218
+ * available as literal characters in route handlers.
219
+ */
220
+ this.server.addHook('preHandler', (request, _, done) => {
221
+ const params = request.params;
222
+ if (params.id !== undefined) {
223
+ try {
224
+ params.id = decodeURIComponent(params.id);
225
+ }
226
+ catch {
227
+ // Malformed URI sequence — keep original value
228
+ }
229
+ }
230
+ done();
231
+ });
216
232
  /**
217
233
  * Sets a global error handler for the Fastify server instance.
218
234
  * This handler checks if the error is an instance of HttpException.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/fastify",
3
- "version": "20260625.1714.32",
3
+ "version": "20260627.17.1",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"
@@ -49,7 +49,7 @@
49
49
  "devDependencies": {
50
50
  "@tmlmobilidade/tsconfig": "*",
51
51
  "@tmlmobilidade/types": "*",
52
- "@types/node": "26.0.0",
52
+ "@types/node": "26.0.1",
53
53
  "resolve-tspaths": "0.8.23",
54
54
  "tsc-watch": "7.2.0",
55
55
  "typescript": "6.0.3"