Browse Source

Workaround issue 220: Unable to create pdf for yahoo.com, by allowing the good load check to be disabled

Antialize 15 years ago
parent
commit
932cc7fee1
3 changed files with 10 additions and 4 deletions
  1. 1 0
      src/arguments.cc
  2. 8 4
      src/multipageloader.cc
  3. 1 0
      src/settings.hh

+ 1 - 0
src/arguments.cc

@@ -476,6 +476,7 @@ CommandLineParserPrivate::CommandLineParserPrivate(Settings & s):
 	qthack(false);
 	
 	extended(true);
+	addarg("ignore-load-errors", 0, "Ignore pages that claimes to have encountered an error during loading", new ConstSetter<bool>(s.ignoreLoadErrors, true, false));
 	addarg("custom-header",0,"Set an additional HTTP header (repeatable)", new MapSetter<>(s.customHeaders, "name", "value"));
 	addarg("manpage", 0, "Output program man page", new Caller<ManPageFunc>());
 	addarg("htmldoc", 0, "Output program html help", new Caller<ReadmeFunc<true> >());

+ 8 - 4
src/multipageloader.cc

@@ -366,13 +366,17 @@ void MultiPageLoaderPrivate::loadProgress(int progress) {
 
 void MultiPageLoaderPrivate::loadFinished(bool ok) {
 	loadingPages--;
-	error = error || !ok;
+	error = error || (!ok && !settings.ignoreLoadErrors);
 	if (!pageToIndex.count(QObject::sender())) return;
 	
 	int idx=pageToIndex[QObject::sender()];
-
-	if (!ok)
-		emit outer.error(QString("Failed loading page ") + urls[idx].toString());
+	
+	if (!ok) {
+		if (!settings.ignoreLoadErrors)
+			emit outer.error(QString("Failed loading page ") + urls[idx].toString()+" (sometimes it will work just to ignore this error with --ignore-load-errors)");
+		else
+			emit outer.warning(QString("Failed loading page ") + urls[idx].toString()+" (ignored)");
+	}
 
 	if (!finishedList[idx]) {
 		finishedList[idx] = true;

+ 1 - 0
src/settings.hh

@@ -204,6 +204,7 @@ struct Settings {
 	QList< QString > allowed;
 	bool useCompression;
 	bool produceForms;
+	bool ignoreLoadErrors;
 
 	static QPrinter::PageSize strToPageSize(const char * s, bool * ok=0);
 	static QPair<qreal, QPrinter::Unit> strToUnitReal(const char * s, bool * ok=0);