mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Resolve file path before read file
This commit is contained in:
parent
9c463532d8
commit
08d62af899
@ -6,6 +6,7 @@ const replaceall = require('replaceall');
|
||||
const logWarning = require('./Error').logWarning;
|
||||
const BbPromise = require('bluebird');
|
||||
const os = require('os');
|
||||
const fse = require('../utils/fs/fse');
|
||||
|
||||
class Variables {
|
||||
|
||||
@ -230,9 +231,13 @@ class Variables {
|
||||
.replace(this.fileRefSyntax, (match, varName) => varName.trim())
|
||||
.replace('~', os.homedir());
|
||||
|
||||
const referencedFileFullPath = (path.isAbsolute(referencedFileRelativePath) ?
|
||||
let referencedFileFullPath = (path.isAbsolute(referencedFileRelativePath) ?
|
||||
referencedFileRelativePath :
|
||||
path.join(this.serverless.config.servicePath, referencedFileRelativePath));
|
||||
|
||||
// Get real path to handle potential symlinks
|
||||
referencedFileFullPath = fse.realpathSync(referencedFileFullPath, 'utf8');
|
||||
|
||||
let fileExtension = referencedFileRelativePath.split('.');
|
||||
fileExtension = fileExtension[fileExtension.length - 1];
|
||||
// Validate file exists
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user