Explorar o código

more safe extra lib filePath generation

Olga Lesnikova %!s(int64=6) %!d(string=hai) anos
pai
achega
6d8ff4c54f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/monaco.contribution.ts

+ 1 - 1
src/monaco.contribution.ts

@@ -42,7 +42,7 @@ export class LanguageServiceDefaultsImpl implements monaco.languages.typescript.
 
 
 	addExtraLib(content: string, filePath?: string): IDisposable {
 	addExtraLib(content: string, filePath?: string): IDisposable {
 		if (typeof filePath === 'undefined') {
 		if (typeof filePath === 'undefined') {
-			filePath = `ts:extralib-${Date.now()}`;
+			filePath = `ts:extralib-${Math.random().toString(36).substring(2, 15)}`;
 		}
 		}
 
 
 		if (this._extraLibs[filePath]) {
 		if (this._extraLibs[filePath]) {