소스 검색

fix: use Object.prototype.hasOwnProperty.call for null-prototype translations object

Object.create(null) objects don't inherit hasOwnProperty, so the direct
call throws. Use the safe form instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rugk 1 개월 전
부모
커밋
e5b3940e37
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      js/privatebin.js

+ 1 - 1
js/privatebin.js

@@ -753,7 +753,7 @@ window.PrivateBin = (function () {
             }
 
             // if no translation string cannot be found (in translations object)
-            if (!translations.hasOwnProperty(messageId) || language === null) {
+            if (!Object.prototype.hasOwnProperty.call(translations, messageId) || language === null) {
                 // if language is still loading and we have an element assigned
                 if (language === null && element !== null) {
                     // handle the error by attaching the language loaded event