Skip to content

Commit

Permalink
Bug 1195133 - Part 1: allow the insertion of URLs with no extractable…
Browse files Browse the repository at this point in the history
… domain.
  • Loading branch information
rnewman authored and Stephan Leroux committed Aug 18, 2015
1 parent 9e3cc23 commit b55570b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Storage/SQL/SQLiteHistory.swift
Expand Up @@ -633,9 +633,19 @@ extension SQLiteHistory: SyncableHistory {
(insertDomain, [host]),
(insertHistory, [place.guid, place.url, place.title, serverModified, host])
]) >>> always(place.guid)
}
} else {
// This is a URL with no domain. Insert it directly.
if LogPII {
log.debug("Inserting: \(place.url) with no domain.")
}

return deferResult(DatabaseError(description: "Could not get a domain for \(place.url)"))
let insertDomain = "INSERT OR IGNORE INTO \(TableDomains) (domain) VALUES (?)"
let insertHistory = "INSERT INTO \(TableHistory) (guid, url, title, server_modified, is_deleted, should_upload, domain_id) " +
"(?, ?, ?, ?, 0, 0, NULL)"
return self.db.run([
(insertHistory, [place.guid, place.url, place.title, serverModified])
]) >>> always(place.guid)
}
}

// Make sure that we only need to compare GUIDs by pre-merging on URL.
Expand Down

0 comments on commit b55570b

Please sign in to comment.