From 63b9f19b2653659d02d46b4d3b1ecacac997116e Mon Sep 17 00:00:00 2001 From: theonlymirage Date: Sun, 17 May 2020 23:23:52 +0000 Subject: [PATCH] WebView: check URL (on "./" and absolute path) when downloading files and copying link to clipboard git-svn-id: svn://kolibrios.org@7943 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/WebView.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index be58799dd3..1a762236ab 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -388,6 +388,7 @@ void EventChangeEncodingAndLoadPage(int _new_encoding) void ProcessEvent(dword id__) { + char new_clip_url[URL_SIZE+1]; switch (id__) { case ENCODINGS...ENCODINGS+6: @@ -459,12 +460,23 @@ void ProcessEvent(dword id__) open_new_window = false; return; case COPY_LINK_URL: - Clipboard__CopyText(PageLinks.GetURL(PageLinks.active)); + strncpy(#new_clip_url, PageLinks.GetURL(PageLinks.active), URL_SIZE); + if ( strcmp(#new_clip_url, "./", 2) ) + { + Clipboard__CopyText( GetAbsoluteURL(#new_clip_url, history.current()) ); + } + else { + Clipboard__CopyText( PageLinks.GetURL(PageLinks.active) ); + } notify("'URL copied to clipboard'O"); return; case DOWNLOAD_LINK_CONTENTS: if (!downloader_opened) { strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active)); + if ( strcmp(#downloader_edit, "./", 2) ) + { + GetAbsoluteURL(#downloader_edit, history.current()); + } CreateThread(#Downloader,#downloader_stak+4092); } return;