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

Fail gracefully when getting a page during a bork #111

Merged
merged 4 commits into from
Feb 4, 2025
Merged

Conversation

rossjrw
Copy link
Member

@rossjrw rossjrw commented Jan 30, 2025

During a wikibork, Wikidot will show an error page. I believe this is what is causing an error when trying to get a page ID, because I do not verify the content of the page before getting the ID, and receiving an error page means the request technically succeeded.

I need to work out how to reliably detect an error page before I can complete this.

  • Detect 200 error page Actually it is a 500
  • Detect 500 error

Naive solution if I can't: page ID not in page AND some known error text present.

Countercase: theme:wikifot must not match.

@rossjrw rossjrw added the bug Something isn't working label Jan 30, 2025
@rossjrw
Copy link
Member Author

rossjrw commented Jan 31, 2025

Bork dump:

<html>
<head>
<title>Please try again</title>
<meta http-equiv="Content-type: text/html; charset=utf-8"/>
<style type="text/css">
 
body {
    width: 700px;
    margin: 30px auto;
    font-family: Verdana, sans-serif;
    font-size: 13px;
    color: #000;
    background: #fff;
}
 
h1 {
    font-family: Verdana, sans-serif;
    font-size: 24px;
    margin: 0 0 15px;
    padding: 0;
}
 
a {
    color: #00f;
}
 
#content {
    width: 400px;
    padding-right: 20px;
    float: left;
    overflow: hidden;
}

pre {
    color: #666;
    font-size: smaller;
}
 
/* Flickr badge CSS */
#flickr_badge_uber_wrapper {text-align:center; width:260px; float: right;}
#flickr_badge_wrapper {padding:10px 0 10px 0;}
.flickr_badge_image {margin:0 10px 10px 10px;}
.flickr_badge_image img {border: 1px solid black !important;}
#flickr_badge_source {text-align:center; margin:0 10px 0 10px; font-size: 9px; color: #222}
#flickr_www {display:none;}
/* End of Flickr badge CSS */
 
</style>
</head>
<body>
 
<!-- Flickr badge HTML -->
<div id="flickr_badge_uber_wrapper"><a href="[http://www.flickr.com](view-source:http://www.flickr.com/)" id="flickr_www">www.<strong style="color:#3993ff">flick<span style="color:#ff1c92">r</span></strong>.com</a><div id="flickr_badge_wrapper">
<script type="text/javascript" src="[http://www.flickr.com/badge_code_v2.gne?show_name=1&count=1&display=random&size=m&layout=x&source=all_tag&tag=bsod](view-source:http://www.flickr.com/badge_code_v2.gne?show_name=1&count=1&display=random&size=m&layout=x&source=all_tag&tag=bsod)"></script>
<div id="flickr_badge_source">
<span id="flickr_badge_source_txt">More <a href="[http://www.flickr.com/photos/tags/bsod/](view-source:http://www.flickr.com/photos/tags/bsod/)">photos or video tagged with bsod</a> on Flickr</span><br clear="all" /></div></div></div>
<!-- End of Flickr badge HTML -->
 
<div id="content">
 
<h1>Please try again</h1>
 
<p>
Please try again - there was a problem fetching the page you requested.
Most probably you can just click <a href="javascript:location.reload();">Reload</a> or Ctrl-R and the page will show as you expected.
 
</p>
 
<p>
If you are seeing a lot of these errors, Wikidot may be under stress.
</p>
 
<p>
Thanks for visiting this site, and if you're one of our <br />1 000 000 users, for using wikidot.com for your social web project.
</p>

<pre>ERROR CODE: DB200</pre>
 
</div>
 
</body>
</html>

@rossjrw
Copy link
Member Author

rossjrw commented Feb 4, 2025

Noting that there CAN also be a 500 error when getting the page, but this isn't guaranteed.

It might never have worked!
I have not yet reproduced a bork so I don't know how to detect one just
yet.
That's not something that I can control, but I'd still like to be
notified about it for now
@rossjrw rossjrw merged commit 5d6b867 into main Feb 4, 2025
1 check passed
@rossjrw rossjrw deleted the page-bork branch February 4, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant