()
| 642 | |
| 643 | export class ProblemConfigHandler extends ProblemManageHandler { |
| 644 | async get() { |
| 645 | if (this.pdoc.reference) throw new ProblemIsReferencedError('edit config'); |
| 646 | this.response.body.testdata = sortFiles(this.pdoc.data || []); |
| 647 | const configFile = (this.pdoc.data || []).filter((i) => i.name.toLowerCase() === 'config.yaml'); |
| 648 | this.response.body.config = ''; |
| 649 | if (configFile.length > 0) { |
| 650 | try { |
| 651 | this.response.body.config = (await streamToBuffer( |
| 652 | await storage.get(`problem/${this.pdoc.domainId}/${this.pdoc.docId}/testdata/${configFile[0].name}`), |
| 653 | )).toString(); |
| 654 | } catch (e) { /* ignore */ } |
| 655 | } |
| 656 | this.response.template = 'problem_config.html'; |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | export class ProblemFilesHandler extends ProblemDetailHandler { |
nothing calls this directly
no test coverage detected