Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
texjs-web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Mehren
texjs-web
Commits
06d7e8c6
Verified
Commit
06d7e8c6
authored
7 years ago
by
Shane Kilkelly
Committed by
David Mehren
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Handle linked-output-files from v1 imports
parent
9215d957
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/coffee/Features/LinkedFiles/ProjectFileAgent.coffee
+5
-1
5 additions, 1 deletion
app/coffee/Features/LinkedFiles/ProjectFileAgent.coffee
app/coffee/Features/LinkedFiles/ProjectOutputFileAgent.coffee
+38
-30
38 additions, 30 deletions
...coffee/Features/LinkedFiles/ProjectOutputFileAgent.coffee
with
43 additions
and
31 deletions
app/coffee/Features/LinkedFiles/ProjectFileAgent.coffee
+
5
−
1
View file @
06d7e8c6
...
...
@@ -60,6 +60,10 @@ SourceFileNotFoundError.prototype.__proto__ = Error.prototype
module
.
exports
=
ProjectFileAgent
=
V1ProjectNotFoundError
:
V1ProjectNotFoundError
_v1ProjectNotFoundMessage
:
"Sorry, the source project is not yet imported to Overleaf v2. Please import it to Overleaf v2 to refresh this file"
sanitizeData
:
(
data
)
->
return
_
.
pick
(
data
,
...
...
@@ -155,7 +159,7 @@ module.exports = ProjectFileAgent =
else
if
error
instanceof
ProjectNotFoundError
res
.
status
(
404
).
send
(
"Project not found"
)
else
if
error
instanceof
V1ProjectNotFoundError
res
.
status
(
409
).
send
(
"Sorry, the source project is not yet imported to Overleaf v2. Please import it to Overleaf v2 to refresh this file"
)
res
.
status
(
409
).
send
(
ProjectFileAgent
.
_v1ProjectNotFoundMessage
)
else
next
(
error
)
next
()
This diff is collapsed.
Click to expand it.
app/coffee/Features/LinkedFiles/ProjectOutputFileAgent.coffee
+
38
−
30
View file @
06d7e8c6
...
...
@@ -6,6 +6,7 @@ Settings = require 'settings-sharelatex'
CompileManager
=
require
'../Compile/CompileManager'
CompileController
=
require
'../Compile/CompileController'
ClsiCookieManager
=
require
'../Compile/ClsiCookieManager'
ProjectFileAgent
=
require
'./ProjectFileAgent'
_
=
require
"underscore"
request
=
require
"request"
...
...
@@ -42,31 +43,36 @@ module.exports = ProjectOutputFileAgent = {
source_output_file_path
:
data
.
source_output_file_path
}
canCreate
:
(
data
)
->
tru
e
canCreate
:
ProjectFileAgent
.
canCreat
e
decorateLinkedFileData
:
(
data
,
callback
=
(
err
,
newData
)
->
)
->
callback
=
_
.
once
(
callback
)
ProjectGetter
.
getProject
data
.
source_project_id
,
{
name
:
1
},
(
err
,
project
)
->
return
callback
(
err
)
if
err
?
if
!
project
?
return
callback
(
new
ProjectNotFoundError
())
callback
(
err
,
_
.
extend
(
data
,
{
source_project_display_name
:
project
.
name
}))
_getSourceProject
:
ProjectFileAgent
.
_getSourceProject
decorateLinkedFileData
:
ProjectFileAgent
.
decorateLinkedFileData
_validate
:
(
data
)
->
return
(
(
data
.
source_project_id
?
||
data
.
v1_source_doc_id
?
)
&&
data
.
source_output_file_path
?
)
checkAuth
:
(
project_id
,
data
,
current_user_id
,
callback
=
(
error
,
allowed
)
->
)
->
callback
=
_
.
once
(
callback
)
{
source_project_id
}
=
data
AuthorizationManager
.
canUserReadProject
current_user_id
,
source_project_id
,
null
,
(
err
,
canRead
)
->
if
!
ProjectOutputFileAgent
.
_validate
(
data
)
return
callback
(
new
BadDataError
())
@
_getSourceProject
data
,
(
err
,
project
)
->
return
callback
(
err
)
if
err
?
AuthorizationManager
.
canUserReadProject
current_user_id
,
project
.
_id
,
null
,
(
err
,
canRead
)
->
return
callback
(
err
)
if
err
?
callback
(
null
,
canRead
)
_validate
:
(
data
)
->
data
.
source_project_id
?
&&
data
.
source_output_file_path
?
writeIncomingFileToDisk
:
(
project_id
,
data
,
current_user_id
,
callback
=
(
error
,
fsPath
)
->
)
->
callback
=
_
.
once
(
callback
)
if
!
ProjectOutputFileAgent
.
_validate
(
data
)
return
callback
(
new
BadDataError
())
{
source_project_id
,
source_output_file_path
}
=
data
{
source_output_file_path
}
=
data
@
_getSourceProject
data
,
(
err
,
project
)
->
return
callback
(
err
)
if
err
?
source_project_id
=
project
.
_id
CompileManager
.
compile
source_project_id
,
null
,
{},
(
err
)
->
return
callback
(
err
)
if
err
?
url
=
"
#{
Settings
.
apis
.
clsi
.
url
}
/project/
#{
source_project_id
}
/output/
#{
source_output_file_path
}
"
...
...
@@ -92,6 +98,8 @@ module.exports = ProjectOutputFileAgent = {
res
.
status
(
404
).
send
(
"Could not get output file"
)
else
if
error
instanceof
ProjectNotFoundError
res
.
status
(
404
).
send
(
"Project not found"
)
else
if
error
instanceof
ProjectFileAgent
.
V1ProjectNotFoundError
res
.
status
(
404
).
send
(
ProjectFileAgent
.
_v1ProjectNotFoundMessage
)
else
next
(
error
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment