Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uploadIcon() should delete the icon when the upload fails (or override it) #356

Open
RAYs3T opened this issue Mar 11, 2020 · 0 comments
Open

Comments

@RAYs3T
Copy link

RAYs3T commented Mar 11, 2020

Problem Description

If you upload an icon but the upload fails, the icon is somehow create on the teamspeak side but actually not uploaded.
So if you try to upload the icon the second time, the upload fails, because the file already exists. Tho this error is not reported back. The exception is only thrown on the first attempt. For all later attempts there is internally a "file already exists" exception but it is not thrown back.

What can cause the problem?

  • File transfer port not open on remote machine

Possible solutions

Delete the icon after failure

Once the upload failed, delete the icon via the ID. This will prevent the CRC created id being "blocked" for further uploads.

Set the override property to "true"

Since the uploader most likely wants to replace the icons anyways this would prevent the "file already exists" error and the upload can fail as often as wanted.
You also can check if an icon is already present beforehand.

https://github.com/TheHolyWaffle/TeamSpeak-3-Java-API/blob/master/src/main/java/com/github/theholywaffle/teamspeak3/TS3ApiAsync.java#L5234

uploadFileDirect(data, path, false, 0) // < Change this to true
				.onSuccess(__ -> future.set(iconId))
				.onFailure(transformError(future, 2050, iconId));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant