Index: content/browser/download/save_package.cc |
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc |
index f38f9cdb1e4f7a074f10b251024d58e9ab8a6b69..056d9b65cdd954fc071ae962ac1e37f49ef58e16 100644 |
--- a/content/browser/download/save_package.cc |
+++ b/content/browser/download/save_package.cc |
@@ -255,13 +255,12 @@ SavePackage::~SavePackage() { |
} |
GURL SavePackage::GetUrlToBeSaved() { |
- // Instead of using web_contents_.GetURL here, we use url() (which is the |
- // "real" url of the page) from the NavigationEntry because it reflects its |
- // origin rather than the displayed one (returned by GetURL) which may be |
- // different (like having "view-source:" on the front). |
- NavigationEntry* active_entry = |
- web_contents()->GetController().GetActiveEntry(); |
- return active_entry->GetURL(); |
+ // The URL to be saved is the real resource URL, not the one displayed to |
+ // the user, which can be a friendly format one. Use the NavigationEntry |
+ // URL instead of WebContents, since the latter gives us the user visible URL. |
+ NavigationEntry* last_committed_entry = |
+ web_contents()->GetController().GetLastCommittedEntry(); |
+ return last_committed_entry ? last_committed_entry->GetURL() : GURL(); |
} |
void SavePackage::Cancel(bool user_action) { |