[API/Mobidziennik] Fix homework attachment downloading.

This commit is contained in:
Kuba Szczodrzyński 2020-04-06 19:28:04 +02:00
parent 041bfc6cc0
commit 238250e8c9
2 changed files with 6 additions and 6 deletions

View File

@ -97,7 +97,7 @@ object Regexes {
"""zadanieFormularz\(([0-9]+),""".toRegex(DOT_MATCHES_ALL)
}
val MOBIDZIENNIK_HOMEWORK_ATTACHMENT by lazy {
"""zalacznik=([0-9]+)'.+?word-break">(.+?)</td>""".toRegex(DOT_MATCHES_ALL)
"""zalacznik(_zadania)?=([0-9]+)'.+?word-break">(.+?)</td>""".toRegex(DOT_MATCHES_ALL)
}

View File

@ -29,14 +29,14 @@ class MobidziennikWebGetAttachment(override val data: DataMobidziennik,
val typeUrl = when (owner) {
is Message -> if (owner.type == Message.TYPE_SENT)
"dziennik/wiadwyslana?id="
"dziennik/wiadwyslana/?id="
else
"dziennik/wiadodebrana?id="
"dziennik/wiadodebrana/?id="
is Event -> if (owner.date >= Date.getToday())
"mobile/zadaniadomowe?id_zadania="
"dziennik/zadaniedomowe/?id_zadania="
else
"mobile/zadaniadomowearchiwalne?id_zadania="
"dziennik/zadaniedomowe/?id_zadania="
else -> ""
}
@ -47,7 +47,7 @@ class MobidziennikWebGetAttachment(override val data: DataMobidziennik,
else -> -1
}
webGetFile(TAG, "/$typeUrl${ownerId}&zalacznik=$attachmentId", targetFile, { file ->
webGetFile(TAG, "/$typeUrl${ownerId}&uczen=${data.studentId}&zalacznik=$attachmentId", targetFile, { file ->
val event = AttachmentGetEvent(
profileId,