Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Lib/StudyplusSDK/Studyplus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ final public class Studyplus {

switch url.pathComponents[1] {
case "success":
guard url.pathComponents.count >= 3 else {
delegate?.studyplusLoginFail(error: .unknownUrl(url))
return false
}

let accessToken: Data = url
.pathComponents[2]
.trimmingCharacters(in: .whitespacesAndNewlines)
Expand Down Expand Up @@ -184,7 +189,8 @@ final public class Studyplus {
guard let scheme = url.scheme else { return false }
guard scheme == "studyplus-\(consumerKey)" else { return false }

if url.pathComponents.isEmpty {
// handle(_:) reads pathComponents[1], so at least 2 components are required
if url.pathComponents.count < 2 {
return false
}

Expand Down