feat: enhance URL validation and timeout handling in knowledge base components
- Added isValidURL function to validate URLs before rendering links in the document content component, preventing invalid links from being clickable. - Refactored timeout handling in KnowledgeBase.vue to use setTimeout instead of setInterval, improving performance and resource management. - Ensured that timeouts are cleared appropriately to avoid memory leaks and unnecessary polling. This update improves the robustness of URL handling and optimizes the component's performance.
This commit is contained in:
@@ -162,8 +162,8 @@ func IsValidURL(url string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// 检查协议, 只允许 http, https, local, minio, cos, tos 协议
|
||||
allowedProtocols := []string{"http://", "https://", "local://", "minio://", "cos://", "tos://"}
|
||||
// 检查协议, 只允许 http, https, local, minio, cos, tos, oss 协议
|
||||
allowedProtocols := []string{"http://", "https://", "local://", "minio://", "cos://", "tos://", "oss://"}
|
||||
isAllowed := false
|
||||
for _, protocol := range allowedProtocols {
|
||||
if strings.HasPrefix(strings.ToLower(url), protocol) {
|
||||
|
||||
Reference in New Issue
Block a user