Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Truncate details to avoid 414 error on Google Calendar site #3

Merged
merged 1 commit into from

2 participants

@woodchuck

A long description yields this error on the Google Calendar site:

414 That’s an error.

The requested URL /calendar/b/0/render... is too large to process. That’s all we know.

This is how I worked around it, although it would probably be better to check the length of the entire url.

@tardate tardate merged commit 57f2c6e into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 25, 2011
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +7 −0 jquery.addtocal.js
View
7 jquery.addtocal.js
@@ -107,6 +107,13 @@
eventDetails.end.toRFC3339UTCString(true,true) : eventDetails.end );
eventDetails.location = ( eventDetails.location ? encodeURIComponent( eventDetails.location ) : '' );
eventDetails.details = ( eventDetails.details ? encodeURIComponent( eventDetails.details ) : '' );
+ // avoid 414 error due to overlong url
+ var MAX_DETAILS_LENGTH = 1550;
+ if (eventDetails.details.length > MAX_DETAILS_LENGTH) {
+ eventDetails.details = eventDetails.details.substr(0, MAX_DETAILS_LENGTH);
+ eventDetails.details.replace(/%[^0-9]*$/, "");
+ eventDetails.details += "...";
+ }
eventDetails.url = ( eventDetails.url ? encodeURIComponent( eventDetails.url ) : '' );
return eventDetails;
},
Something went wrong with that request. Please try again.