185 @param forUrl flag indicating to sanitize an URL text |
185 @param forUrl flag indicating to sanitize an URL text |
186 @type bool |
186 @type bool |
187 @return processed text |
187 @return processed text |
188 @rtype str |
188 @rtype str |
189 """ |
189 """ |
190 if text == "UNKNOWN": |
190 if text == "UNKNOWN" or text is None: |
191 text = "" |
191 text = "" |
192 elif text == "any": |
192 elif text == "any": |
193 text = self.tr("any") |
193 text = self.tr("any") |
194 elif text is None: |
|
195 text = "" |
|
196 if forUrl and ( |
194 if forUrl and ( |
197 not isinstance(text, str) or |
195 not isinstance(text, str) or |
198 not text.startswith(("http://", "https://", "ftp://")) |
196 not text.startswith(("http://", "https://", "ftp://")) |
199 ): |
197 ): |
200 # ignore if the schema is not one of the listed ones |
198 # ignore if the schema is not one of the listed ones |