Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>tags/1.9.1
| got_request_exception.send(current_app, exception=e) | got_request_exception.send(current_app, exception=e) | ||||
| status_code = 500 | status_code = 500 | ||||
| data = getattr(e, "data", {"message": http_status_message(status_code)}) | |||||
| data: dict[str, Any] = getattr(e, "data", {"message": http_status_message(status_code)}) | |||||
| # 🔒 Normalize non-mapping data (e.g., if someone set e.data = Response) | # 🔒 Normalize non-mapping data (e.g., if someone set e.data = Response) | ||||
| if not isinstance(data, dict): | if not isinstance(data, dict): |
| from Crypto import Random | from Crypto import Random | ||||
| from Crypto.Signature.pss import MGF1 | from Crypto.Signature.pss import MGF1 | ||||
| from Crypto.Util.number import bytes_to_long, ceil_div, long_to_bytes | from Crypto.Util.number import bytes_to_long, ceil_div, long_to_bytes | ||||
| from Crypto.Util.py3compat import _copy_bytes, bord | |||||
| from Crypto.Util.py3compat import bord | |||||
| from Crypto.Util.strxor import strxor | from Crypto.Util.strxor import strxor | ||||
| else: | else: | ||||
| self._mgf = lambda x, y: MGF1(x, y, self._hashObj) | self._mgf = lambda x, y: MGF1(x, y, self._hashObj) | ||||
| self._label = _copy_bytes(None, None, label) | |||||
| self._label = bytes(label) | |||||
| self._randfunc = randfunc | self._randfunc = randfunc | ||||
| def can_encrypt(self): | def can_encrypt(self): | ||||
| # Step 2b | # Step 2b | ||||
| ps = b"\x00" * ps_len | ps = b"\x00" * ps_len | ||||
| # Step 2c | # Step 2c | ||||
| db = lHash + ps + b"\x01" + _copy_bytes(None, None, message) | |||||
| db = lHash + ps + b"\x01" + bytes(message) | |||||
| # Step 2d | # Step 2d | ||||
| ros = self._randfunc(hLen) | ros = self._randfunc(hLen) | ||||
| # Step 2e | # Step 2e |
| def send(self, mail: dict): | def send(self, mail: dict): | ||||
| logger.debug("Sending email with SendGrid") | logger.debug("Sending email with SendGrid") | ||||
| _to = "" | |||||
| try: | try: | ||||
| _to = mail["to"] | _to = mail["to"] | ||||
| content = Content("text/html", mail["html"]) | content = Content("text/html", mail["html"]) | ||||
| sg_mail = Mail(from_email, to_email, subject, content) | sg_mail = Mail(from_email, to_email, subject, content) | ||||
| mail_json = sg_mail.get() | mail_json = sg_mail.get() | ||||
| response = sg.client.mail.send.post(request_body=mail_json) # ty: ignore [call-non-callable] | |||||
| response = sg.client.mail.send.post(request_body=mail_json) # type: ignore | |||||
| logger.debug(response.status_code) | logger.debug(response.status_code) | ||||
| logger.debug(response.body) | logger.debug(response.body) | ||||
| logger.debug(response.headers) | logger.debug(response.headers) |
| "migrations/", | "migrations/", | ||||
| "core/rag", | "core/rag", | ||||
| "extensions", | "extensions", | ||||
| "libs", | |||||
| "controllers/console/datasets", | "controllers/console/datasets", | ||||
| "core/ops", | "core/ops", | ||||
| "core/model_runtime", | "core/model_runtime", |