Skip to content

Commit

Permalink
open editor for translated content (mdn#3196)
Browse files Browse the repository at this point in the history
* open editor for translated content

* fix parsing locale
  • Loading branch information
fiji-flo authored and peterbe committed Jun 1, 2021
1 parent 383779d commit cd85799
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const fakeV1APIRouter = require("./fake-v1-api");
const { searchIndexRoute } = require("./search-index");
const flawsRoute = require("./flaws");
const { staticMiddlewares, originRequestMiddleware } = require("./middlewares");
const { getRoot } = require("../content/utils");

async function buildDocumentFromURL(url) {
const document = Document.findByURL(url);
Expand Down Expand Up @@ -107,7 +108,9 @@ app.get("/_open", (req, res) => {
if (fs.existsSync(filepath)) {
absoluteFilepath = filepath;
} else {
absoluteFilepath = path.join(CONTENT_ROOT, filepath);
const [locale] = filepath.split(path.sep);
const root = getRoot(locale);
absoluteFilepath = path.join(root, filepath);
}

// Double-check that the file can be found.
Expand Down

0 comments on commit cd85799

Please sign in to comment.