If our frame content doesnt exist, treat it as frame not found

This commit is contained in:
Deon George 2024-12-09 16:12:49 +11:00
parent 41940a0a70
commit 8ca782e996
3 changed files with 14 additions and 4 deletions

View File

@ -900,7 +900,7 @@ function Page(debug) {
var f = new File(filename); var f = new File(filename);
if (! f.exists || ! f.open('rb',true)) { if (! f.exists || ! f.open('rb',true)) {
log(LOG_ERROR,'|? File doesnt exist: ['+filename+']'); log(LOG_ERROR,'|? File doesnt exist: ['+filename+']');
return false; return undefined;
} }
var content = f.read(); var content = f.read();
@ -958,7 +958,6 @@ function Page(debug) {
log(LOG_ERROR,'|? File doesnt exist: ['+filename+']'); log(LOG_ERROR,'|? File doesnt exist: ['+filename+']');
return false; return false;
} }
var contents = JSON.parse(f.read()); var contents = JSON.parse(f.read());
contents.date = f.date; contents.date = f.date;
f.close(); f.close();
@ -967,6 +966,10 @@ function Page(debug) {
if (contents.version === 2) if (contents.version === 2)
contents.content = this.file_content(FRAMES_HOME+SESSION_EXT+'/'+this.name.toString()+'.'+CONTENT_EXT); contents.content = this.file_content(FRAMES_HOME+SESSION_EXT+'/'+this.name.toString()+'.'+CONTENT_EXT);
// The content file doesnt exist
if (contents.content === undefined)
return false;
var valid_sauce = false; var valid_sauce = false;
if (contents.content.substr(-128, 7) === 'SAUCE00') { if (contents.content.substr(-128, 7) === 'SAUCE00') {
@ -1055,7 +1058,7 @@ function Page(debug) {
var contents = mb.getContent(msg.number); var contents = mb.getContent(msg.number);
if (contents === undefined) if ((contents === undefined) || (contents.content[SESSION_EXT] === undefined))
return false; return false;
contents.content = contents.content[SESSION_EXT]; contents.content = contents.content[SESSION_EXT];

View File

@ -43,3 +43,7 @@ if (p.get(po)) {
} else { } else {
writeln('Failed to load:'+argv[0]); writeln('Failed to load:'+argv[0]);
} }
writeln('----');
for (var x in p.raw)
writeln(x+':'+JSON.stringify(p.raw[x])+"\r\n");

View File

@ -27,6 +27,9 @@ p.get(po);
var SESSION_EXT = 'vtx'; var SESSION_EXT = 'vtx';
require('ansitex/load/session/viewdata.js','SESSION_VIEWDATA'); require('ansitex/load/session/viewdata.js','SESSION_VIEWDATA');
p.raw = p.file_content(FRAMES_HOME+SESSION_EXT+'/'+po.toString()+'.'+CONTENT_EXT); var vtx = p.file_content(FRAMES_HOME+SESSION_EXT+'/'+po.toString()+'.'+CONTENT_EXT);
if (vtx !== undefined)
p.raw = vtx;
p.save(); p.save();