Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't throw if a doc hasn't been versioned yet #455

Merged
merged 1 commit into from
Feb 17, 2018
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions lib/server/versionFallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ files.forEach(file => {
// what the requested version is
function docVersion(id, req_version) {
if (!available[id]) {
throw new Error(
`Document with id '${id}' was requested but no document with that id could be located.`
);
return null;
}
// iterate through versions until a version less than or equal to the requested
// is found, then check if that version has an available file to use
Expand Down
3 changes: 1 addition & 2 deletions lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ files.forEach(file => {
metadata.original_id = metadata.id;
metadata.id = 'version-' + version + '-' + metadata.id;

const targetFile =
CWD + '/versioned_docs/version-' + version + '/' + path.basename(file);
const targetFile = versionFolder + '/' + path.basename(file);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

versionFolder is defined above as:

const versionFolder = CWD + '/versioned_docs/version-' + version;

So might as well not repeat the same full path again.


fs.writeFileSync(targetFile, makeHeader(metadata) + rawContent, 'utf8');
});
Expand Down