Skip to content

Commit

Permalink
Remove hashWithPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
seadowg committed Nov 25, 2021
1 parent 0d611f4 commit 62955ac
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class OpenRosaResponseParserImpl : OpenRosaResponseParser {
hash = XFormParser.getXMLText(child, true)
if (hash != null && (hash.length == 0 || !hash.startsWith("md5:"))) {
hash = null
} else {
hash = hash.substring("md5:".length)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class FormsUpdaterTest {
"http://$formId",
formId,
formVersion,
"md5:${getMd5Hash(updatedXForm)}",
getMd5Hash(updatedXForm),
"blah",
null
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class ServerFormsDetailsFetcherTest {
@Test
fun whenAFormExists_andItsNewerVersionWithManifestIsAvailableButHasNullHash_isNotNewOrUpdated() {
whenever(formSource.fetchFormList()).thenReturn(
listOf(FORM_WITH_MANIFEST.copy(hashWithPrefix = null))
listOf(FORM_WITH_MANIFEST.copy(hash = null))
)

formsRepository.save(
Expand Down Expand Up @@ -342,13 +342,13 @@ private val MEDIA_FILE = MediaFile(
)

private val FORM_WITHOUT_MANIFEST =
FormListItem("http://example.com/form-1", "form-1", "1", "md5:form-1-hash", "Form 1", null)
FormListItem("http://example.com/form-1", "form-1", "1", "form-1-hash", "Form 1", null)

private val FORM_WITH_MANIFEST = FormListItem(
"http://example.com/form-2",
"form-2",
"2",
"md5:form-2-hash",
"form-2-hash",
"Form 2",
MANIFEST_URL
)
7 changes: 2 additions & 5 deletions forms/src/main/java/org/odk/collect/forms/FormListItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ data class FormListItem(
val downloadURL: String,
val formID: String,
val version: String,
private val hashWithPrefix: String?,
val hash: String?,
val name: String,
val manifestURL: String?
) {

val hash = hashWithPrefix?.substring("md5:".length)
}
)

0 comments on commit 62955ac

Please sign in to comment.