Closed Bug 7636 Opened 26 years ago Closed 24 years ago

Image SRC and Link location fields must check for local file format

Categories

(Core :: DOM: Editor, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: cmanske, Assigned: cmanske)

Details

(Whiteboard: [nsbeta3+])

Attachments

(1 file)

In any dialog containing an edit field where an image or href can be enterred, we must check to be sure the text is in URL format (http:// or file:///) Using the "Choose File..." button will do that automatically (in editor only, not using the INPUT TYPE="FILE" widget). But the user may type something using local file format. This is not an easy problem. We need an new method in nsFileSpec code to detect different platform formats and do the appropriate conversions to using nsFileURL.
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → INVALID
First, let me say once again that an end-user should never have to type these things (paths and URLs) in order to create a web page. There should be a browse button, and two radio buttons: (x) absolute ( ) relative. The computer should convert these into a URL. Second, I don't think you should allow "either". The rubric near the edit field should clearly say what is required. Or else (again) radio buttons: (x) URL ( ) path: [ ] That opinion expressed, this is not the job of nsFileSpec. What's wrong with the following code? You can write a similar function for checking for a native path. nsresult ValidateFileURL(const char* myTypedInURL) { nsFileURL allegedURL(myTypedInURL); nsFileSpec allegedFileSpec(allegedURL); if (!allegedFileSpec.Valid() || !allegedFileSpec.Exists()) return NS_ERROR_INVALIDENTRY; // I made this up. return NS_OK } nsresult ValidateFilePath(const char* myTypedInPath) { nsFileSpec allegedFileSpec(myTypedInPath); if (!allegedFileSpec.Valid() || !allegedFileSpec.Exists()) return NS_ERROR_INVALIDENTRY; // I made this up. return NS_OK } Marking invalid, because I think this answer is sufficent. I know you'll reopen it if you disagree.
Charley, can you mark this one VERIFIED_FIXED? thanks!
Status: RESOLVED → REOPENED
Status: REOPENED → ASSIGNED
John: I fully understand you comments, but you keep forgetting that these edit fields are not just for local files, but for remote URLs as well. Unfortunately, we don't have a good "Browse..." option for that. Thus we will have to allow editing these fields. Now I am trying to respect the Mac behavior by always converting the local file picked via a "Choose File..." button to "file:///" (URL) format before it is put into the edit field. But on a Windows or UNIX platform, there will be users who enter in local file paths, and I believe they should be allowed to do that. Thus there is the need for converting them to URL format. I will use your suggestions to write such a validator.
Resolution: INVALID → ---
Target Milestone: M8
Target Milestone: M8 → M9
Target Milestone: M9 → M11
Changing for a later milestone.
Target Milestone: M11 → M12
Changing target
Target Milestone: M12 → M17
moving to post beta, setting to M17
Target Milestone: M17 → M14
Changing to M14.
Target Milestone: M14 → M15
Moving to M15
The attached test file works, although there is an ugly drawing problem when the scrollbar first appears.
Damn. Attached file to wrong bug. Ignore it and last comment.
Moving to next milestone
Target Milestone: M15 → M16
Moving bugs to M17 to concentrate on features in M16
Target Milestone: M16 → M17
Keywords: correctness, nsbeta3
Target Milestone: M17 → M18
Whiteboard: [nsbeta3+]
Do a quick check for "file:" That's about all we can do for now.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago24 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
verified in 8/31 build.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: