Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/utils/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { normalizePath } from 'docc-render/utils/assets';
import {
queryStringForParams, areEquivalentLocations, getAbsoluteUrl,
} from 'docc-render/utils/url-helper';
import { getSetting } from 'docc-render/utils/theme-settings';
import emitWarningForSchemaVersionMismatch from 'docc-render/utils/schema-version-check';
import RedirectError from 'docc-render/errors/RedirectError';
import FetchError from 'docc-render/errors/FetchError';
Expand Down Expand Up @@ -56,8 +57,15 @@ export async function fetchData(path, params = {}, options = {}) {
}

function createDataPath(path) {
const dataPath = path.replace(/\/$/, '');
return `${normalizePath(['/data', dataPath])}.json`;
function filePathFor(path) {
if (process.env.VUE_APP_TARGET !== 'ide' &&
getSetting(['features', 'docs', 'portablePaths', 'enable'], false)) {
return path.replace(/\/$/, "").replace(/[<>:"\/\\|*]/, "_");
} else {
return path.replace(/\/$/, "")
}
}
return `${normalizePath(['/data', filePathFor(path)])}.json`;
}

/**
Expand Down