fixing display of version 1 pastes without attachments
This commit is contained in:
parent
12a9b2ff8e
commit
b44e729a1a
|
@ -4245,27 +4245,34 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paste.hasOwnProperty('attachment') && paste.hasOwnProperty('attachmentname')) {
|
let format = '',
|
||||||
|
text = '';
|
||||||
|
if (paste.hasOwnProperty('ct')) {
|
||||||
|
// version 2 paste
|
||||||
|
const pasteMessage = JSON.parse(pastePlain);
|
||||||
|
if (pasteMessage.hasOwnProperty('attachment') && pasteMessage.hasOwnProperty('attachment_name')) {
|
||||||
|
AttachmentViewer.setAttachment(pasteMessage.attachment, pasteMessage.attachment_name);
|
||||||
|
AttachmentViewer.showAttachment();
|
||||||
|
}
|
||||||
|
format = paste.adata[1];
|
||||||
|
text = pasteMessage.paste;
|
||||||
|
} else {
|
||||||
// version 1 paste
|
// version 1 paste
|
||||||
|
if (paste.hasOwnProperty('attachment') && paste.hasOwnProperty('attachmentname')) {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
CryptTool.decipher(key, password, paste.attachment),
|
CryptTool.decipher(key, password, paste.attachment),
|
||||||
CryptTool.decipher(key, password, paste.attachmentname)
|
CryptTool.decipher(key, password, paste.attachmentname)
|
||||||
]).then((attachment) => {
|
]).then((attachment) => {
|
||||||
AttachmentViewer.setAttachment(attachment[0], attachment[1]);
|
AttachmentViewer.setAttachment(attachment[0], attachment[1]);
|
||||||
});
|
|
||||||
PasteViewer.setFormat(paste.meta.formatter);
|
|
||||||
PasteViewer.setText(pastePlain);
|
|
||||||
} else {
|
|
||||||
// version 2 paste
|
|
||||||
const pasteMessage = JSON.parse(pastePlain);
|
|
||||||
if (pasteMessage.hasOwnProperty('attachment') && pasteMessage.hasOwnProperty('attachment_name')) {
|
|
||||||
AttachmentViewer.setAttachment(pasteMessage.attachment, pasteMessage.attachment_name);
|
|
||||||
}
|
|
||||||
PasteViewer.setFormat(paste.adata[1]);
|
|
||||||
PasteViewer.setText(pasteMessage.paste);
|
|
||||||
}
|
|
||||||
PasteViewer.run();
|
|
||||||
AttachmentViewer.showAttachment();
|
AttachmentViewer.showAttachment();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
format = paste.meta.formatter;
|
||||||
|
text = pastePlain;
|
||||||
|
}
|
||||||
|
PasteViewer.setFormat(format);
|
||||||
|
PasteViewer.setText(text);
|
||||||
|
PasteViewer.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4377,7 +4384,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// decrypt paste & attachments
|
// decrypt paste & attachments
|
||||||
decryptionPromises.push(decryptPaste(paste, key, password))
|
decryptionPromises.push(decryptPaste(paste, key, password));
|
||||||
|
|
||||||
// if the discussion is opened on this paste, display it
|
// if the discussion is opened on this paste, display it
|
||||||
if ((paste.adata && paste.adata[2]) || paste.meta.opendiscussion) {
|
if ((paste.adata && paste.adata[2]) || paste.meta.opendiscussion) {
|
||||||
|
@ -4395,7 +4402,6 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
// wait for the user to type in the password,
|
// wait for the user to type in the password,
|
||||||
// then PasteDecrypter.run will be called again
|
// then PasteDecrypter.run will be called again
|
||||||
console.log(decryptionPromises);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ if ($MARKDOWN):
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-30YZX80ZfNAAMVDZdnHCp8rY1X66o9LhQ1LShA0JqGtFfvboDuoX9z9fuv/gIvo/MBs8qH6/14omf0bFlmnXkg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-t9Zs9EkImSMS7DBczj95hrZi7CErcJ7w66LxUgy3dmu02AiiF0Mp/WNeq0MDIctCkepOde0o/E/0N4ETX/Z5TA==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
|
@ -50,7 +50,7 @@ if ($MARKDOWN):
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-30YZX80ZfNAAMVDZdnHCp8rY1X66o9LhQ1LShA0JqGtFfvboDuoX9z9fuv/gIvo/MBs8qH6/14omf0bFlmnXkg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-t9Zs9EkImSMS7DBczj95hrZi7CErcJ7w66LxUgy3dmu02AiiF0Mp/WNeq0MDIctCkepOde0o/E/0N4ETX/Z5TA==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
Loading…
Reference in New Issue