|
|
@@ -24,6 +24,7 @@ import _ from 'lodash'
|
|
|
import Async from 'async'
|
|
|
import Errors from '../Errors/Errors.js'
|
|
|
import { promisify } from '@overleaf/promise-utils'
|
|
|
+import HistoryURLHelper from '../History/HistoryURLHelper.js'
|
|
|
|
|
|
let ReferencesHandler
|
|
|
|
|
|
@@ -38,18 +39,6 @@ export default ReferencesHandler = {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- _buildFileUrl(projectId, historyId, fileRef) {
|
|
|
- const filestoreURL = `${settings.apis.filestore.url}/project/${projectId}/file/${fileRef._id}`
|
|
|
- if (fileRef.hash) {
|
|
|
- return {
|
|
|
- url: `${settings.apis.project_history.url}/project/${historyId}/blob/${fileRef.hash}`,
|
|
|
- fallbackURL: filestoreURL,
|
|
|
- }
|
|
|
- } else {
|
|
|
- return { url: filestoreURL }
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
_findBibFileRefs(project) {
|
|
|
const fileRefs = []
|
|
|
function _process(folder) {
|
|
|
@@ -179,7 +168,12 @@ export default ReferencesHandler = {
|
|
|
ReferencesHandler._buildDocUrl(projectId, docId)
|
|
|
)
|
|
|
const bibFileUrls = fileRefs.map(fileRef =>
|
|
|
- ReferencesHandler._buildFileUrl(projectId, historyId, fileRef)
|
|
|
+ HistoryURLHelper.projectHistoryURLWithFilestoreFallback(
|
|
|
+ settings,
|
|
|
+ projectId,
|
|
|
+ historyId,
|
|
|
+ fileRef
|
|
|
+ )
|
|
|
)
|
|
|
const sourceURLs = bibDocUrls.concat(bibFileUrls)
|
|
|
return request.post(
|