tileserver-gl 4.11.0 → 4.12.0

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.
package/src/utils.js CHANGED
@@ -4,7 +4,7 @@ import path from 'path';
4
4
  import fsPromises from 'fs/promises';
5
5
  import fs, { existsSync } from 'node:fs';
6
6
  import clone from 'clone';
7
- import glyphCompose from '@mapbox/glyph-pbf-composite';
7
+ import { combine } from '@jsse/pbfont';
8
8
 
9
9
  /**
10
10
  * Restrict user input to an allowed set of options.
@@ -48,6 +48,12 @@ const getUrlObject = (req) => {
48
48
  const urlObject = new URL(`${req.protocol}://${req.headers.host}/`);
49
49
  // support overriding hostname by sending X-Forwarded-Host http header
50
50
  urlObject.hostname = req.hostname;
51
+
52
+ // support add url prefix by sending X-Forwarded-Path http header
53
+ const xForwardedPath = req.get('X-Forwarded-Path');
54
+ if (xForwardedPath) {
55
+ urlObject.pathname = path.posix.join(xForwardedPath, urlObject.pathname);
56
+ }
51
57
  return urlObject;
52
58
  };
53
59
 
@@ -207,8 +213,8 @@ export const getFontsPbf = async (
207
213
  );
208
214
  }
209
215
 
210
- const values = await Promise.all(queue);
211
- return glyphCompose.combine(values);
216
+ const combined = combine(await Promise.all(queue), names);
217
+ return Buffer.from(combined.buffer, 0, combined.buffer.length);
212
218
  };
213
219
 
214
220
  export const listFonts = async (fontPath) => {