mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 21:43:24 -07:00
Fixed for Imgur annonymous upload.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2177 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
4713847d2e
commit
428b84ac6d
2 changed files with 17 additions and 13 deletions
|
@ -4,7 +4,7 @@ Greenshot: A screenshot tool optimized for productivity. Save a screenshot or a
|
||||||
CHANGE LOG:
|
CHANGE LOG:
|
||||||
We changed the version to 1.0 after 5 years it should no longer have a "beta" feeling!
|
We changed the version to 1.0 after 5 years it should no longer have a "beta" feeling!
|
||||||
|
|
||||||
1.0.4 build 2176 Release Candidate 4
|
1.0.4 build 2177 Release Candidate 4
|
||||||
|
|
||||||
Bugs resolved:
|
Bugs resolved:
|
||||||
* Fixed error during OAuth process due to authorization dialog not opening, see bug #3578480
|
* Fixed error during OAuth process due to authorization dialog not opening, see bug #3578480
|
||||||
|
|
|
@ -112,22 +112,26 @@ namespace GreenshotImgurPlugin {
|
||||||
}
|
}
|
||||||
string responseString = null;
|
string responseString = null;
|
||||||
if (config.AnonymousAccess) {
|
if (config.AnonymousAccess) {
|
||||||
// add key
|
// add key, we only use the other parameters for the AnonymousAccess
|
||||||
uploadParameters.Add("key", IMGUR_ANONYMOUS_API_KEY);
|
otherParameters.Add("key", IMGUR_ANONYMOUS_API_KEY);
|
||||||
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(config.ImgurApiUrl + "/upload.xml?" + NetworkHelper.GenerateQueryParameters(uploadParameters) + NetworkHelper.GenerateQueryParameters(otherParameters));
|
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(config.ImgurApiUrl + "/upload.xml?" + NetworkHelper.GenerateQueryParameters(otherParameters));
|
||||||
webRequest.Method = "POST";
|
webRequest.Method = "POST";
|
||||||
webRequest.ContentType = "image/" + outputSettings.Format.ToString();
|
webRequest.ContentType = "image/" + outputSettings.Format.ToString();
|
||||||
webRequest.ServicePoint.Expect100Continue = false;
|
webRequest.ServicePoint.Expect100Continue = false;
|
||||||
|
try {
|
||||||
using (var requestStream = webRequest.GetRequestStream()) {
|
using (var requestStream = webRequest.GetRequestStream()) {
|
||||||
ImageOutput.SaveToStream(image, requestStream, outputSettings);
|
ImageOutput.SaveToStream(image, requestStream, outputSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
responseString = NetworkHelper.GetResponse(webRequest);
|
|
||||||
using (WebResponse response = webRequest.GetResponse()) {
|
using (WebResponse response = webRequest.GetResponse()) {
|
||||||
LogCredits(response);
|
|
||||||
using (StreamReader reader = new StreamReader(response.GetResponseStream(), true)) {
|
using (StreamReader reader = new StreamReader(response.GetResponseStream(), true)) {
|
||||||
responseString = reader.ReadToEnd();
|
responseString = reader.ReadToEnd();
|
||||||
}
|
}
|
||||||
|
LogCredits(response);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOG.Error("Upload to imgur gave an exeption: ", ex);
|
||||||
|
throw ex;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OAuthSession oAuth = new OAuthSession(ImgurCredentials.CONSUMER_KEY, ImgurCredentials.CONSUMER_SECRET);
|
OAuthSession oAuth = new OAuthSession(ImgurCredentials.CONSUMER_KEY, ImgurCredentials.CONSUMER_SECRET);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue