MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / checkTrojanSource

Function checkTrojanSource

web/pgadmin/static/js/utils.js:382–391  ·  view source on GitHub ↗
(content, isPasteEvent)

Source from the content-addressed store, hash-verified

380}
381
382export function checkTrojanSource(content, isPasteEvent) {
383 // Call the hasTrojanSource function of 'anti-trojan-source' package
384 if (hasTrojanSource({ sourceText: content})) {
385 let msg = gettext('The file opened contains bidirectional Unicode characters which could be interpreted differently than what is displayed. If this is unexpected it is recommended that you review the text in an application that can display hidden Unicode characters before proceeding.');
386 if (isPasteEvent) {
387 msg = gettext('The pasted text contains bidirectional Unicode characters which could be interpreted differently than what is displayed. If this is unexpected it is recommended that you review the text in an application that can display hidden Unicode characters before proceeding.');
388 }
389 pgAdmin.Browser.notifier.alert(gettext('Trojan Source Warning'), msg);
390 }
391}
392
393export function toPrettySize(rawSize, from='B', decimalFixed=null) {
394 try {

Callers 2

QueryFunction · 0.90
handlePasteFunction · 0.90

Calls 2

gettextFunction · 0.85
alertMethod · 0.80

Tested by

no test coverage detected