diff --git a/src/plugins/cpaster/codepasterprotocol.cpp b/src/plugins/cpaster/codepasterprotocol.cpp index bc8137abfd8423d4e76d310a166837fb6a30ccc8..bd7657656c80e69fe084d190fe1d71fbb53164b1 100644 --- a/src/plugins/cpaster/codepasterprotocol.cpp +++ b/src/plugins/cpaster/codepasterprotocol.cpp @@ -99,13 +99,24 @@ void CodePasterProtocol::fetch(const QString &id) QTC_ASSERT(!m_fetchReply, return; ) QString hostName = m_page->hostName(); - QString link = "http://"; - link.append(hostName); - link.append("/?format=raw&id="); - link.append(id); + const QString httpPrefix = "http://"; + QString link; + // Did the user enter a complete URL instead of an id? + if (id.startsWith(httpPrefix)) { + // Append 'raw' format option + link = id; + link += QLatin1String("&format=raw"); + const int idPos = id.lastIndexOf(QLatin1Char('=')); + m_fetchId = idPos != -1 ? id.mid(idPos + 1) : id; + } else { + link = httpPrefix; + link.append(hostName); + link.append("/?format=raw&id="); + link.append(id); + m_fetchId = id; + } m_fetchReply = httpGet(link); connect(m_fetchReply, SIGNAL(finished()), this, SLOT(fetchFinished())); - m_fetchId = id; } void CodePasterProtocol::list()