mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 07:04:04 -05:00
Missing tree filenames short link fix (#7379)
This commit is contained in:
@@ -339,7 +339,10 @@ export class ClientStateNormalizer {
|
||||
const session = this.normalized.findSessionById(file.editorId);
|
||||
if (session) {
|
||||
file.content = session.source;
|
||||
file.filename = session.filename;
|
||||
if (!file.filename && session.filename) {
|
||||
// it's fine if the session doesn't contain the filename, the filename in the tree is always leading
|
||||
file.filename = session.filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import express from 'express';
|
||||
import {AppDefaultArguments, CompilerExplorerOptions} from '../../app.js';
|
||||
import {isString} from '../../shared/common-utils.js';
|
||||
import {Language} from '../../types/languages.interfaces.js';
|
||||
import {assert, unwrap} from '../assert.js';
|
||||
import {assert} from '../assert.js';
|
||||
import {ClientStateGoldenifier, ClientStateNormalizer} from '../clientstate-normalizer.js';
|
||||
import {ClientState} from '../clientstate.js';
|
||||
import {CompilationEnvironment} from '../compilation-env.js';
|
||||
@@ -281,7 +281,7 @@ export class RouteAPI {
|
||||
|
||||
if (tree.isCMakeProject) {
|
||||
const firstSource = tree.files.find(file => {
|
||||
return unwrap(file.filename).startsWith('CMakeLists.txt');
|
||||
return file.filename?.startsWith('CMakeLists.txt');
|
||||
});
|
||||
|
||||
if (firstSource) {
|
||||
@@ -289,7 +289,7 @@ export class RouteAPI {
|
||||
}
|
||||
} else {
|
||||
const firstSource = tree.files.find(file => {
|
||||
return unwrap(file.filename).startsWith('example.');
|
||||
return file.filename?.startsWith('example.');
|
||||
});
|
||||
|
||||
if (firstSource) {
|
||||
|
||||
Reference in New Issue
Block a user