@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix "expected null or a string, got: int" on Jupyter Notebook

Summary:
The value needs to be an integer per specification and per the next check in the code.
Previous rPb08c7c761c1078658da02ba68fcb4b0f67912438 was not fully correct.

```
EXCEPTION: (InvalidArgumentException) Call to phutil_nonempty_string() expected null or a string, got: int. at [<arcanist>/src/utils/utils.php:2121]
#0 <#2> phutil_nonempty_string(integer) called at [<phorge>/src/applications/files/document/PhabricatorJupyterDocumentEngine.php:326]
```

Fixes T16312

Test Plan:
* Go to http://phorge.localhost/file/upload/
* Upload a valid JSON text file: `{"nbformat": 0, "nbformat_minor": 5, "metadata": {}, "cells": []}`
* On resulting http://phorge.localhost/F1, select "View Options > View as Jupyter Notebook"

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: mainframe98, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16312

Differential Revision: https://we.phorge.it/D26435

+3 -3
+3 -3
src/applications/files/document/PhabricatorJupyterDocumentEngine.php
··· 323 323 } 324 324 325 325 $nbformat = idx($data, 'nbformat'); 326 - if (!phutil_nonempty_string($nbformat)) { 326 + if (!is_int($nbformat)) { 327 327 throw new Exception( 328 328 pht( 329 - 'This document is missing an "nbformat" field. Jupyter notebooks '. 330 - 'must have this field.')); 329 + 'This document lacks a valid "nbformat" field. Jupyter notebooks '. 330 + 'must have this field and it must have an integer value.')); 331 331 } 332 332 333 333 if ($nbformat !== 4) {