mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
use fs.copyFile instead of fse.copy in UrlCache module
This commit is contained in:
parent
44e0742aa3
commit
371de76a4a
2 changed files with 3 additions and 6 deletions
|
@ -19,7 +19,6 @@ const UrlFetcher = require('./UrlFetcher')
|
|||
const Settings = require('settings-sharelatex')
|
||||
const crypto = require('crypto')
|
||||
const fs = require('fs')
|
||||
const fse = require('fs-extra')
|
||||
const logger = require('logger-sharelatex')
|
||||
const async = require('async')
|
||||
|
||||
|
@ -36,7 +35,7 @@ module.exports = UrlCache = {
|
|||
if (error != null) {
|
||||
return callback(error)
|
||||
}
|
||||
return fse.copy(pathToCachedUrl, destPath, function (error) {
|
||||
return fs.copyFile(pathToCachedUrl, destPath, function (error) {
|
||||
if (error != null) {
|
||||
logger.error(
|
||||
{ err: error, from: pathToCachedUrl, to: destPath },
|
||||
|
|
|
@ -27,8 +27,7 @@ describe('UrlCache', function () {
|
|||
'settings-sharelatex': (this.Settings = {
|
||||
path: { clsiCacheDir: '/cache/dir' }
|
||||
}),
|
||||
fs: (this.fs = {}),
|
||||
'fs-extra': (this.fse = { copy: sinon.stub().yields() })
|
||||
fs: (this.fs = { copyFile: sinon.stub().yields() })
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
@ -249,7 +248,6 @@ describe('UrlCache', function () {
|
|||
beforeEach(function () {
|
||||
this.cachePath = 'path/to/cached/url'
|
||||
this.destPath = 'path/to/destination'
|
||||
this.UrlCache._copyFile = sinon.stub().callsArg(2)
|
||||
this.UrlCache._ensureUrlIsInCache = sinon
|
||||
.stub()
|
||||
.callsArgWith(3, null, this.cachePath)
|
||||
|
@ -269,7 +267,7 @@ describe('UrlCache', function () {
|
|||
})
|
||||
|
||||
it('should copy the file to the new location', function () {
|
||||
return this.fse.copy
|
||||
return this.fs.copyFile
|
||||
.calledWith(this.cachePath, this.destPath)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue