mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-09 17:00:27 +00:00
Fix streaming of attachment tiddlers from recipe URIs
This commit is contained in:
parent
e3ce053745
commit
239aacfa03
@ -41,17 +41,24 @@ exports.handler = function(request,response,state) {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// This is not a JSON API request, we should return the raw tiddler content
|
// This is not a JSON API request, we should return the raw tiddler content
|
||||||
var type = tiddlerInfo.tiddler.type || "text/plain";
|
const result = $tw.mws.store.getBagTiddlerStream(title,tiddlerInfo.bag_name);
|
||||||
if(!response.headersSent) {
|
if(result) {
|
||||||
|
if(!response.headersSent){
|
||||||
response.writeHead(200, "OK",{
|
response.writeHead(200, "OK",{
|
||||||
Etag: state.makeTiddlerEtag(tiddlerInfo),
|
Etag: state.makeTiddlerEtag(result),
|
||||||
"Content-Type": type
|
"Content-Type": result.type
|
||||||
});
|
});
|
||||||
response.write(tiddlerInfo.tiddler.text || "",($tw.config.contentTypeInfo[type] ||{encoding: "utf8"}).encoding);
|
}
|
||||||
|
result.stream.pipe(response);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if(!response.headersSent){
|
||||||
|
response.writeHead(404);
|
||||||
response.end();
|
response.end();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!response.headersSent) {
|
if(!response.headersSent) {
|
||||||
// Redirect to fallback URL if tiddler not found
|
// Redirect to fallback URL if tiddler not found
|
||||||
|
Loading…
Reference in New Issue
Block a user