Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

AssetsService issue. Endless recursion. #18

Open
valk8 opened this issue Jan 22, 2018 · 1 comment
Open

AssetsService issue. Endless recursion. #18

valk8 opened this issue Jan 22, 2018 · 1 comment

Comments

@valk8
Copy link

valk8 commented Jan 22, 2018

Recursive call at line 118 asset.go causes a stack overflow, I guess you need to unmarshal manually the json, since it's a custom handler.

func (asset *Asset) UnmarshalJSON(data []byte) error {
...
} else {
	if err := json.Unmarshal(data, asset); err != nil {
		return err
	}
}
...
@ddevcap
Copy link
Contributor

ddevcap commented May 16, 2018

Using an alias fixes the issue.

func (asset *Asset) UnmarshalJSON(data []byte) error {
    type Alias *Asset
...
} else {
    if err := json.Unmarshal(data, Alias(asset)); err != nil {
         return err
    }
}
...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants