mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 22:29:01 +02:00
Use path.resolve for resolving paths (#28905)
GitOrigin-RevId: 8f549b410ebf35e330a472fd4de1e3343747794e
This commit is contained in:
Generated
+1
@@ -52822,6 +52822,7 @@
|
||||
"nock": "^13.5.6",
|
||||
"nvd3": "^1.8.6",
|
||||
"p-reflect": "^3.1.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"pdfjs-dist": "5.1.91",
|
||||
"pirates": "^4.0.1",
|
||||
"postcss": "^8.4.31",
|
||||
|
||||
@@ -2,6 +2,7 @@ import pLimit from 'p-limit'
|
||||
import { Change, Chunk, Snapshot, File } from 'overleaf-editor-core'
|
||||
import { RawChange, RawChunk } from 'overleaf-editor-core/lib/types'
|
||||
import { FetchError, getJSON, postJSON } from '@/infrastructure/fetch-json'
|
||||
import path from 'path-browserify'
|
||||
|
||||
const DOWNLOAD_BLOBS_CONCURRENCY = 10
|
||||
|
||||
@@ -101,21 +102,21 @@ export class ProjectSnapshot {
|
||||
|
||||
const snapshotPaths = new Set(this.snapshot.getFilePathnames())
|
||||
|
||||
const baseURLs = [
|
||||
const basePaths = [
|
||||
// relative to the root of the compile directory
|
||||
new URL('https://overleaf.invalid'),
|
||||
'/',
|
||||
]
|
||||
|
||||
if (currentPath !== '/') {
|
||||
// relative to the current directory
|
||||
baseURLs.push(new URL(currentPath, 'https://overleaf.invalid'))
|
||||
basePaths.push(currentPath)
|
||||
}
|
||||
|
||||
const extensionsToTest = ['', ...extensions]
|
||||
|
||||
for (const baseURL of baseURLs) {
|
||||
for (const basePath of basePaths) {
|
||||
for (const extension of extensionsToTest) {
|
||||
const { pathname } = new URL(`${filePath}${extension}`, baseURL)
|
||||
const pathname = path.resolve(basePath, `${filePath}${extension}`)
|
||||
const snapshotPath = pathname.substring(1) // remove leading slash
|
||||
if (snapshotPaths.has(snapshotPath)) {
|
||||
return snapshotPath
|
||||
|
||||
@@ -351,6 +351,7 @@
|
||||
"mock-fs": "^5.1.2",
|
||||
"nock": "^13.5.6",
|
||||
"nvd3": "^1.8.6",
|
||||
"path-browserify": "^1.0.1",
|
||||
"p-reflect": "^3.1.0",
|
||||
"pdfjs-dist": "5.1.91",
|
||||
"pirates": "^4.0.1",
|
||||
|
||||
Reference in New Issue
Block a user