Fix CourseBook term validation to accept uppercase semesters and reject partial matches
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
Direzione di ricerca
Inizia dalla dichiarazione di termRegex e dalla relativa chiamata a MatchString in scrapers/coursebook.go, dove ScrapeCoursebook valida il termine prima della configurazione. Leggi l'esempio del README che usa -term 24F per confermare l'input previsto. È completato quando 24F, 24f, 26S e 26u vengono accettati e normalizzati in minuscolo, mentre 4f, 124f, 24fextra, abc24f e 24X vengono rifiutati con un errore chiaro prima dell'avvio del browser.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
CourseBook term validation uses the unanchored regex [0-9]{1,2}[sfu] in scrapers/coursebook.go.
This causes two problems:
- Uppercase terms such as
24F, as documented in the README, are rejected. - Malformed terms such as
4f,124f, and24fextrapass validation because the regex accepts a matching substring.
Expected behavior:
- Accept exactly two digits followed by
S,U, orF, case-insensitively. - Normalize accepted terms to the lowercase format used by the CourseBook scraper before further processing.
- Reject malformed terms with a clear error before initializing the browser or making requests.
Steps To Reproduce
- Build the executable with
make build(orbuild.bat buildon Windows). - Run the documented command:
./api-tools -scrape -coursebook -term 24F - Observe that validation rejects the uppercase semester.
- Inspect
termRegexand itsMatchStringcall inscrapers/coursebook.go: the pattern also accepts4f,124f, and24fextra.
Malformed values that pass validation proceed toward browser initialization, so inspecting the regex is sufficient to confirm that behavior without starting a scrape.
Additional Context
Starting points:
- scrapers/coursebook.go:
termRegexandScrapeCoursebook. - README.md: the scraping example uses
-term 24F.
Suggested manual checks:
- Accept
24F,24f,26S, and26u. - Reject
4f,124f,24fextra,abc24f, and24X. - Confirm accepted terms reach scraper setup in the same normalized format.
Keep this task limited to term validation and normalization. Broader scraper error handling is covered by #192.
Environment
Identified by source inspection of commit 3f3585e; not reproduced by executing the scraper. The regex behavior is platform-independent.
- Lingua principale
- Go
- Stelle
- 12
- Fork
- 54
- Merge medio
- 14g 1h
- PR unite (30g)
- 1
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di UTDNebula/api-tools
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Improve unit tests in sectionParser_test.goForse già presa @Sidd-Pelluru l’ha presa 42 giorni fa. ApertaL1 recommended for recruits
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Improve unit tests in discountsParser_test.goForse di nuovo libera @LikithInam l’ha presa 28 giorni fa e non c’è nessuna pull request aperta. ApertaL1 recommended for recruits
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
L1 recommended for recruits
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Comet Calendar events with multiple locationsForse già presa @azythromycin l’ha presa 22 giorni fa. ApertaL1 Type: Bug Report
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Tutte le issue di UTDNebula/api-tools
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
teradata-labs/loom#574 ·
I maintainer di solito rispondono entro 1 giorno
-
cli: name the CRID when saved link limits fail after publish; soften plain-republish mint warningApertaenhancement pr-polish-followup priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
layervai/qurl-integrations#1994 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: `Match exec "step ssh check-host %h"` causes SSH connections through ProxyJump to hangApertabug needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
CycloneDX/cyclonedx-go#304 ·
-
[Bug]: snowflake_share fails to read a share attached to a listing with target accounts ('TARGETED ACCOUNTS' in the "to" column)Forse già presa @akhil9tiet l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
snowflakedb/terraform-provider-snowflake#5366 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno