Closed Bug 341837 Opened 19 years ago Closed 18 years ago

microsummary service should impose limit on length of microsummary

Categories

(Firefox Graveyard :: Microsummaries, defect, P1)

2.0 Branch
defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 2 beta2

People

(Reporter: myk, Assigned: jminta)

Details

(Keywords: fixed1.8.1, Whiteboard: [has patch])

Attachments

(1 file)

The microsummary service should impose a limit on the length of microsummaries to prevent overlong microsummaries from causing problems. The limit should be large enough that it doesn't impact microsummary usability (i.e. it doesn't visibly truncate microsummaries in the UI) while being small enough to ensure we can easily handle the amount of data. 4096 characters seems reasonable for text microsummaries.
OS: Linux → All
Priority: -- → P1
Hardware: PC → All
Whiteboard: [swag: 0.25d]
Flags: blocking-firefox2?
Flags: blocking-firefox2? → blocking-firefox2+
Target Milestone: Firefox 2 beta1 → Firefox 2 beta2
Whiteboard: [swag: 0.25d] → [myk-mss] [swag: 0.25d]
Component: Bookmarks → Microsummaries
Whiteboard: [myk-mss] [swag: 0.25d] → [swag: 0.25d]
Whiteboard: [swag: 0.25d] → [swag: 0.25d][at risk]
Talked to myk about taking this one. -> me
Assignee: myk → jminta
Attached patch limit to 4096Splinter Review
Patch limits the size of the returned summary to 4096 characters.
Attachment #230443 - Flags: review?
Attachment #230443 - Flags: review? → review?(myk)
Comment on attachment 230443 [details] [diff] [review] limit to 4096 >- if (this.content) >- return this.content.replace(/^\s+|\s+$/g, ""); >- else if (this.template) >+ if (this.content) { >+ var content = this.content.replace(/^\s+|\s+$/g, ""); >+ if (content.length > MAX_SUMMARY_LENGTH) >+ content = content.substring(0, MAX_SUMMARY_LENGTH); >+ return content; >+ } else if (this.template) > return this._processTemplate(pageContent); Nit: it'd be useful to mention why we don't truncate template-generated content here (i.e. because we truncate it inside processTemplate instead). Or perhaps it'd make sense to factor out that code, truncating both kinds in the same place. >@@ -1746,16 +1755,17 @@ function getLoadedMicrosummaryResource(u > * Removes all characters not in the "chars" string from aName. > * > * @returns a sanitized name to be used as a filename, or a random name > * if a sanitized name cannot be obtained (if aName contains > * no valid characters). > */ > function sanitizeName(aName) { > const chars = "-abcdefghijklmnopqrstuvwxyz0123456789"; >+ const maxLength = 60; > > var name = aName.toLowerCase(); > name = name.replace(/ /g, "-"); > //name = name.split("").filter(function (el) { > // return chars.indexOf(el) != -1; > // }).join(""); > var filteredName = ""; > for ( var i = 0 ; i < name.length ; i++ ) >@@ -1764,16 +1774,19 @@ function sanitizeName(aName) { > name = filteredName; > > if (!name) { > // Our input had no valid characters - use a random name > for (var i = 0; i < 8; ++i) > name += chars.charAt(Math.round(Math.random() * (chars.length - 1))); > } > >+ if (name.length > maxLength) >+ name = name.substring(0, maxLength); >+ This looks like that other patch that was recently checked in. r=myk with this part removed.
Attachment #230443 - Flags: review?(myk) → review+
Landed on trunk. Checking in browser/components/microsummaries/src/nsMicrosummaryService.js.in; /cvsroot/mozilla/browser/components/microsummaries/src/nsMicrosummaryService.js.in,v <-- nsMicrosummaryService.js.in new revision: 1.31; previous revision: 1.30 done
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: [swag: 0.25d][at risk] → [swag: 0.25d]
Comment on attachment 230443 [details] [diff] [review] limit to 4096 Requesting approval. Fairly trivial change here, which ispiked wrote a testcase for, using tinderbox build logs. http://people.mozilla.org/~aguthrie/testcases/microsummaries/test-9.html
Attachment #230443 - Flags: approval1.8.1?
Whiteboard: [swag: 0.25d] → [has patch][needs approval]
Attachment #230443 - Flags: approval1.8.1? → approval1.8.1+
Landed on branch Checking in browser/components/microsummaries/src/nsMicrosummaryService.js.in; /cvsroot/mozilla/browser/components/microsummaries/src/nsMicrosummaryService.js.in,v <-- nsMicrosummaryService.js.in new revision: 1.1.2.33; previous revision: 1.1.2.32 done
Keywords: fixed1.8.1
Whiteboard: [has patch][needs approval] → [has patch]
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: