blob: 026b0e596f9be35290411396285a477174c51116 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
var LocationUtils = require('../../utils/location');
var fileToURL = require('./fileToURL');
/**
Resolve an absolute path (extracted from a link)
@param {Output} output
@param {String} filePath
@return {String}
*/
function resolveFileToURL(output, filePath) {
// Convert /test.png -> test.png
filePath = LocationUtils.toAbsolute(filePath, '', '');
var page = output.getPage(filePath);
// if file is a page, return correct .html url
if (page) {
filePath = fileToURL(output, filePath);
}
return LocationUtils.normalize(filePath);
}
module.exports = resolveFileToURL;
|