Skip to content
This repository was archived by the owner on Sep 14, 2024. It is now read-only.

Category Load Failed: FormatException <!DOCTYPE html> #36

Closed
dogo77 opened this issue Dec 20, 2020 · 30 comments
Closed

Category Load Failed: FormatException <!DOCTYPE html> #36

dogo77 opened this issue Dec 20, 2020 · 30 comments

Comments

@dogo77
Copy link

dogo77 commented Dec 20, 2020

Hi.
Having entered some 40 recipes in Nextcloud 20 with Cookbook 0.7.6
i now wanted to access thes recipes on Android.
So i downloaded Nextcloud Cookbook 0.3.4.

login works fine, i see some "cards" with rotating arrows – at first glance my Recipe Categories.
But then loading fails and all i see is

Category Load Failed: FormatException: Unexpected character (at character 1)
<!DOCTYPE html>
^

pressing "reload" leads to same result.

Any idea whats wrong here?

@Teifun2
Copy link
Owner

Teifun2 commented Dec 26, 2020

Hmm this is weird. When you see the cards with rotating spinners, it tries to fetch all categories and the thumbnail.
The document should be returned in JSON format an not contain any HTML tags as your error message suggests.

To figure out why this happens i first need to be able to reproduce the error.

It would be easiest for me to check out what is wrong if you could create a test account for me and send me the details over on the matrix chat.
https://matrix.to/#/#nextcloud-cookbook:matrix.org

@Teifun2 Teifun2 added the bug Something isn't working label Dec 26, 2020
@Teifun2 Teifun2 changed the title Error at first start Category Load Failed: FormatException <!DOCTYPE html> Dec 26, 2020
@Teifun2
Copy link
Owner

Teifun2 commented Jan 3, 2021

Ok. So i was able to look into this. And it seems that some of the urls to fetch specific data (all recipes of a specific category) are now changed. Therefore it does not get the correct data back.

As it should still work for the others users i need to distinguish between server /app versions and then adapt the urls.

First i need to find out when this was changed.

@AchimLipp
Copy link

Hi,
i also have the same problem. Nextcloud 20.4 with the actual android app.

@Teifun2
Copy link
Owner

Teifun2 commented Jan 11, 2021

Yes the new Version of the plugin on next-cloud broke my app. Now they implemented a way for me to find out which app version is running. I Will start on creating a fix for that!

nextcloud/cookbook#487

@hoyalu
Copy link

hoyalu commented Jan 11, 2021

Same problem with 0.3.6 after updating the Nextcloud app to 0.7.8 on Nextcloud 20.0.4.
Is there a workaround? Perhaps downgrading the Nextcloud app? (If so, how?)

@Guacam-Ole
Copy link

I have exactly the same issue since 0.7.8.
@hoyalu : Dowgrading to 0.7.7 does work as a workaround

Might (or might not) be worth noting at least in my case my categories contain Umlauts ("Geflügel")

@Teifun2
Copy link
Owner

Teifun2 commented Jan 13, 2021

@hoyalu & @OleAlbers
Yes indeed for the newest version 0.7.8 it is borken!
The url to fetch categories has changed (so it has nothing to do with umlauts :( )

To downgrade you should in theory be able to just download version 0.7.7 from github and replace it in the apps folder. But maybe @OleAlbers has a better explanation.

I will work on a fix the coming days! Sorry for the problems!

@Guacam-Ole
Copy link

Guacam-Ole commented Jan 13, 2021

Just the same explanation. Replace the files in the "cookbook"-folder and everything should be fine for now

BTW: Thanks for the work @Teifun2 . Really appreciate it

@hoyalu
Copy link

hoyalu commented Jan 13, 2021

Downgrading to 0.7.7 went wrong. The first thing Nextcloud told me after I had replaced the files was that it was necessary to update an app. Back to 0.7.8 without my being able to stop it. :-(

@Guacam-Ole
Copy link

Thats strange. I also had the Auto-Update-Screen from Nextcloud but the app was still on 0.7.7 afterwards.
Maybe it is worth trying disabling/removing the app first from within Nextcloud so NC does not "remember" there should be something there and then copy the files.

I completely deleted the cookbook-folder before copying the old files btw.
And of course: as always when doing bigger changes: Dont forget to backup first

@Guacam-Ole
Copy link

Guacam-Ole commented Jan 14, 2021

Update: Just out of curiousity I tried and it seems to work

  1. Disable Cookbook in NC
  2. Remove Cookbook in NC
  3. Copy cookbook-folder from old version to "apps" folder
  4. Go to "Disabled Apps"
  5. Enable Cookbook

No Update warnings and Cookbook works like before

@AchimLipp
Copy link

With the new Cookbook Version 0.7.9 there is the same problem.

Just for info

@Teifun2
Copy link
Owner

Teifun2 commented Jan 16, 2021

This issue should now be fixed with the newest update to the app. (can take some hours until it appears on google play)

On the nextcloud side the cookbook now tells the mobile app what version it is running on. I can with this information change behavior based on different versions. If a new version of the nextcloud plugin is released that changes the API and my app is not updated it will now show a warning message that it might no longer work until an update is released!

Please check and tell me if all problems are resolved! @dogo77 @OleAlbers @AchimLipp @hoyalu

@Teifun2 Teifun2 added question and removed bug Something isn't working labels Jan 16, 2021
@dogo77
Copy link
Author

dogo77 commented Jan 17, 2021

Just pulled version 0.3.7 from playstore, but that version didn't solve the problem.
deleted all app data, but still:
same error as before.

@Teifun2
Copy link
Owner

Teifun2 commented Jan 17, 2021

@dogo77 is it possible that you have NC 20 and still cookbook version 0.7.6?
I know that this combination is a special case which got an update that first broke the app. If this is the case you need to update the cookbook to 0.7.9 or higher. Otherwise im confused why this does not work! :/

@Guacam-Ole
Copy link

Guacam-Ole commented Jan 17, 2021

I also have NC 20 (20.0.4) (which is quite common AFAIK because the Auto-Update on "stable" hasn't switched to 21 yet).

Good news is: I can confirm that newest NC-Cookbook-App (0.7.10) and newest Android-App (0,3.6) work fine in this combination.

@dogo77
Copy link
Author

dogo77 commented Jan 17, 2021

@dogo77 is it possible that you have NC 20 and still cookbook version 0.7.6?
I know that this combination is a special case which got an update that first broke the app. If this is the case you need to update the cookbook to 0.7.9 or higher. Otherwise im confused why this does not work! :/

okay, sorry for the confusion:
the nc app was not updated properly, had to delete 0.7.6 manually and reinstalled 0.7.10
Now app on smartphone is loading receipts! Perfect!

@dogo77 dogo77 closed this as completed Jan 17, 2021
@nesasio93
Copy link

Hate to bring this up again, but I still have this issue.

App Version 0.3.8
Nextcloud Version 20.0.6
Nextcloud Cookbook version 0.7.10

I see the categories as boxes with the loading spinners and after one second the error is shown. While I see the loading spinners I can tap a box and see my receipts like it should be. Only the overview is not working 😕

@Guacam-Ole
Copy link

Guacam-Ole commented Jan 28, 2021

Just updated to NC 20.0.6 (which also updated cookbook to 0.7.10) and also have the same issue again

Should be re-opened, @Teifun2

@Teifun2 Teifun2 reopened this Jan 28, 2021
@Teifun2
Copy link
Owner

Teifun2 commented Jan 28, 2021

I will check if I can reproduce this on my instance otherwise I will need help!

@Guacam-Ole
Copy link

If I can I will do. Just tell me where to find logs or something like that.

@Guacam-Ole
Copy link

Guacam-Ole commented Jan 28, 2021

I checked your code and while my knowdlege of dart is zero I at least was able to see where you get the version from. If it helps, this is the version my installation would return on the call you send:

    "cookbook_version": [
        0,
        7,
        10
    ],
    "api_version": {
        "major": 0,
        "minor": 1
    }
}

@nesasio93
Copy link

    "cookbook_version": [
        0,
        7,
        10
    ],
    "api_version": {
        "major": 0,
        "minor": 1
    }
}

Same for my instance!

@AchimLipp
Copy link

I also still have this problem. This problem was not solved for me since the opening of the case. If i could help or provide some logs or somethings linke this please let me know.

Actually i also have Versions:
Nextcloud 20.0.6
Android-App 0.3.8
Cookbokk 0.7.10

@Teifun2
Copy link
Owner

Teifun2 commented Jan 30, 2021

@nesasio93 @OleAlbers @AchimLipp

I checked and i am not able to reproduce this with:
Nextcloud 20.0.6
Android-App 0.3.8
Cookbokk 0.7.10

I'm a little confused how this still happens. But i need a test account from one of you to find out where the problem is hiding ;(

An account on your instance with some sample recipes that, when you log into it reproduces the same error.
([email protected])

@Guacam-Ole
Copy link

I might have a clue here by mistake?

I created a testuser for you and wanted to test that locally before I send the data to you. But my tablet automatically logged me in with my main account so I installed on my smartphone instead.

There it worked. Back again on my tablet I checked the version and it was down to 0.3.3 even though the Play Store indicated that 0.3.8 is the most current one and no updates are available.

I know this really sounds crazy but I DID have at least V 0.3.6 installed which worked. Nontheless uninstalling the app and reinstalling it SOLVED the problem. (now it is on 0.3.8)

No use in sending you my testuser though as everything works on my machine now, too.

@Teifun2
Copy link
Owner

Teifun2 commented Jan 31, 2021

@OleAlbers well that sounds confusing! 🤔

@nesasio93 & @AchimLipp maybe you can reinstall the app to check if that fixes your issue?

@nesasio93
Copy link

Installed the app on a new device: same error!

But I found something confusing in my nextcloud logs and solved the problem:

... "GET /index.php/apps/cookbook/categories HTTP/1.1" 200 1680 "-" "Cookbook App"
... "GET /index.php/apps/cookbook/api/recipes HTTP/1.1" 200 2710 "-" "Cookbook App"
. . .
... "GET /index.php/apps/cookbook/api/category/This/That HTTP/1.1" 302 1673 "-" "Cookbook App"
. . .
... "GET /apps/dashboard/ HTTP/1.1" 200 10673 "-" "Dart/2.10 (dart:io)"

See the 302 Code? I had a category with the name like "this/that" with a "/" in it. This does not work (anymore), it even does not work with the nextcloud app anymore (I just hadn't noticed till today), and thats why the app is calling /apps/dashboard/, which is a html. Renamed my category to "this and that" and now everything works as expected!

Thanks for the help!

@AchimLipp
Copy link

I uninstalled the app and reinstalled it again, but i got the same error.

But i found the problem on my side. I also have activated 2FA as TOTP. I hat some problems with the app-token. I had to delete the token and made a new one and then it worked for me.

Now everything is fine on my side. The authorization was not successfull but i got the same error with the categories.

Thanks.

@Teifun2
Copy link
Owner

Teifun2 commented Apr 17, 2021

Ok so as it works for everyone currently i will close this now!

@Teifun2 Teifun2 closed this as completed Apr 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants